Changeset 3546:769a255d71d9 in orange
 Timestamp:
 04/17/07 11:51:16 (7 years ago)
 Branch:
 default
 Convert:
 2d3abb99ab6d0933fa9ac2f2c2be6084d74809f7
 Location:
 orange/OrangeWidgets/Prototypes
 Files:

 2 edited
Legend:
 Unmodified
 Added
 Removed

orange/OrangeWidgets/Prototypes/OWGraphDrawerCanvas.py
r3517 r3546 177 177 178 178 179 self.visualizer. xCoors[self.selectedVertex] = newX180 self.visualizer. yCoors[self.selectedVertex] = newY179 self.visualizer.coors[self.selectedVertex][0] = newX 180 self.visualizer.coors[self.selectedVertex][1] = newY 181 181 182 182 self.setCurveData(self.vertices[self.selectedVertex], [newX], [newY]) … … 202 202 if len(self.selection) > 0: 203 203 border = self.vertexSize / 2 204 maxx = max(take(self.visualizer. xCoors, self.selection))205 maxy = max(take(self.visualizer. yCoors, self.selection))206 minx = min(take(self.visualizer. xCoors, self.selection))207 miny = min(take(self.visualizer. yCoors, self.selection))204 maxx = max(take(self.visualizer.coors[:,0], self.selection)) 205 maxy = max(take(self.visualizer.coors[:,1], self.selection)) 206 minx = min(take(self.visualizer.coors[:,0], self.selection)) 207 miny = min(take(self.visualizer.coors[:,1], self.selection)) 208 208 #relativni premik v pikslih 209 209 dx = event.pos().x()  self.GMmouseStartEvent.x() … … 260 260 261 261 #self.removeAllSelections() 262 #self.selectionCurveKeyList=[] 262 263 else: 263 264 OWGraph.onMousePressed(self, event) … … 277 278 self.selectVertices() 278 279 OWGraph.onMouseReleased(self, event) 280 self.removeAllSelections() 279 281 280 282 elif self.state == SELECT_POLYGON: … … 305 307 #print "px: " + str(px) + " py: " + str(py) 306 308 for v in range(self.nVertices): 307 x1 = self.visualizer. xCoors[v]308 y1 = self.visualizer. yCoors[v]309 x1 = self.visualizer.coors[v][0] 310 y1 = self.visualizer.coors[v][1] 309 311 #print "x: " + str(x1) + " y: " + str(y1) 310 312 dist = self.dist([px, py], [x1, y1]) … … 321 323 else: 322 324 self.removeSelection() 323 324 # key, dist, xVal, yVal, index = self.closestCurve(pos.x(), pos.y())325 #326 # if key >= 0 and dist < 15:327 # if key in self.indexPairs.keys(): #to se zgodi samo, ce vozlisce ni povezano328 # self.addSelection(self.indexPairs[key])329 # return330 #331 # curve = self.curve(key) #to je povezava, ker so bile te z insertCurve() dodane prej,332 # #da se ne vidijo skozi vozlisca333 #334 # for e in range(self.nEdges):335 # (keyTmp,i,j) = self.edges[e]336 # if keyTmp == key:337 # ndx1 = i338 # ndx2 = j339 #340 # vOb1 = self.curve(self.vertices[ndx1])341 # vOb2 = self.curve(self.vertices[ndx2])342 #343 # px = self.invTransform(curve.xAxis(), pos.x())344 # py = self.invTransform(curve.yAxis(), pos.y())345 #346 # if self.dist([px, py], [vOb1.x(0), vOb1.y(0)]) <= self.dist([px, py], [vOb2.x(0), vOb2.y(0)]):347 # self.addSelection(ndx1)348 # else:349 # self.addSelection(ndx2)350 # else:351 # self.removeSelection()352 325 353 326 def dist(self, s1, s2): … … 367 340 (key,i,j) = self.edges[e] 368 341 369 x1 = self.visualizer. xCoors[i]370 x2 = self.visualizer. xCoors[j]371 y1 = self.visualizer. yCoors[i]372 y2 = self.visualizer. yCoors[j]342 x1 = self.visualizer.coors[i][0] 343 x2 = self.visualizer.coors[j][0] 344 y1 = self.visualizer.coors[i][1] 345 y2 = self.visualizer.coors[j][1] 373 346 374 347 fillColor = Qt.blue#self.discPalette[classValueIndices[self.rawdata[i].getclass().value], 255*insideData[j]] … … 392 365 # draw vertices 393 366 for v in range(self.nVertices): 394 x1 = self.visualizer. xCoors[v]395 y1 = self.visualizer. yCoors[v]367 x1 = self.visualizer.coors[v][0] 368 y1 = self.visualizer.coors[v][1] 396 369 397 370 if self.colorIndex != 1: … … 403 376 newColor = Qt.red #QColor(0,0,0) 404 377 378 379 key = self.addCurve(str(v), fillColor, edgeColor, 6, xData = [x1], yData = [y1]) 380 405 381 if v in self.selection: 406 edgeColor = Qt.green; 407 fillColor = Qt.green; 408 else: 409 fillColor = newColor 410 edgeColor = newColor 411 412 key = self.addCurve(str(v), fillColor, edgeColor, 6, xData = [x1], yData = [y1]) 382 newSymbol = QwtSymbol(QwtSymbol.Ellipse, QBrush(fillColor), QPen(Qt.yellow, 3), QSize(10, 10)) 383 self.setCurveSymbol(key, newSymbol) 384 413 385 self.vertices[v] = key 414 386 self.indexPairs[key] = v … … 417 389 if len(self.labelText) > 0: 418 390 for v in range(self.nVertices): 419 x1 = self.visualizer. xCoors[v]420 y1 = self.visualizer. yCoors[v]391 x1 = self.visualizer.coors[v][0] 392 y1 = self.visualizer.coors[v][1] 421 393 lbl = "" 422 394 for ndx in self.labelText: … … 434 406 if len(self.tooltipText) > 0: 435 407 for v in range(self.nVertices): 436 x1 = self.visualizer. xCoors[v]437 y1 = self.visualizer. yCoors[v]408 x1 = self.visualizer.coors[v][0] 409 y1 = self.visualizer.coors[v][1] 438 410 lbl = "" 439 411 for ndx in self.tooltipText: 
orange/OrangeWidgets/Prototypes/OWNetwork.py
r3515 r3546 171 171 172 172 def setGraph(self, graph): 173 self.visualize = GraphVisualizer(graph, self)173 self.visualize = NetworkVisualizer(graph, self) 174 174 175 175 self.colorCombo.clear() … … 194 194 195 195 #najprej nakljucne koordinate za vsa vozlisca 196 self.visualize.fruchtermanReingold() 196 refreshRate = 10 197 tolerance = 5 198 initTemp = 100 199 200 while True: 201 initTemp = self.visualize.fruchtermanReingold(refreshRate, initTemp) 202 203 if (initTemp <= tolerance): 204 #self.visualize.postProcess() 205 self.updateCanvas() 206 return 207 208 self.updateCanvas() 197 209 198 210 def circular(self):
Note: See TracChangeset
for help on using the changeset viewer.