Did I find the right examples for you? yes no      Crawl my project      Python Jobs

# DataStructures.Point2D

All Samples(12)  |  Call(7)  |  Derive(0)  |  Import(5)
```Simple Wrapper class for a point in 2D-space. Used for Graph
Embeddings.  Use: Point2D([x,y]) or Point2D(x,y)
```

```from GatoGlobals import *
import Graph
from DataStructures import Point2D, VertexLabeling, EdgeLabeling, EdgeWeight, VertexWeight, Queue
import logging
log = logging.getLogger("Gato")
```
```                G.vertexWeights[i][v] = w

E[v] = Point2D(x,y)

if lineNr == lastVertexLineNr + 1: # Read Nr of edges
```
```                    VLabel[v] = eval(d['label'])
P = PairListToDictionary(d['graphics'])
E[v] = Point2D(eval(P['x']), eval(P['y']))

except:
```
```            x = int(m.group(1))
y = int(m.group(2))
E[v] = Point2D(x,y)
else:
m = re.search('(\d+) -> (\d+)', l)
```

```
from GatoGlobals import *
from DataStructures import Point2D, VertexLabeling, EdgeLabeling, EdgeWeight
import GraphUtil #import ConnectedComponents, FindBipartitePartitions

```
```    def SetEmbedding(self,v, x, y):
self.embedding[v] = Point2D(x,y)

def Euclidify(self):
""" Replace edge weights with weightID = 0 with Euclidean distance
```

```
from GatoGlobals import *
from DataStructures import Point2D, VertexLabeling, EdgeLabeling, EdgeWeight
#from math import log

```
```    def SetEmbedding(self,v, x, y):
self.vertices[v].embedding = Point2D(x,y)

def Euclidify(self):
```

```from GatoUtil import orthogonal
from GatoDialogs import AutoScrollbar
from DataStructures import Point2D, VertexLabeling, EdgeLabeling
import os
import colorsys
```
```            x,y = self.EmbeddingToCanvas(t.x,t.y)

return Point2D(x,y)

```

```################################################################################

from DataStructures import Point2D
from Graph import Graph
from Gred import *
```
```                # We only use pos
pos = XMLNode.getElementsByTagName('pos')[0] # Just one pos ...
self.pos = Point2D(float(pos.attributes['x'].nodeValue),
float(pos.attributes['y'].nodeValue))

```