PyANGKernel.GKGeoObject

class GKGeoObject

Base class for all the graphical objects (objects with a representation in 2D and/or 3D Views)

Details

GKGeoObject is the base class for all the objects with a graphical representation. They are stored in layers ( GKLayer ) and these layers are in the GKGeoModel .

When creating a geo object with the newObject , it will not be added to the geomodel. Until then it will not be visible. Add it using the add .

Objects are selected by model, what means that a selected object is selected in all the views in where it appears (2D and/or 3D).

An object can have a mark (or more than one) using setMark to mark it with a special color and/or shape (depending of the object).

An object can be grouped with other ones in a group (GKGeoObjectGroup). In this case the group and not the individual objects will be manipulated.

An object can have object on top of it ( getTopObjects ). These objects belong to this bottom object and are translated, rotated and deleted with it.

See also

GKGeoModel GKLayer

Inheritance diagram of PyANGKernel.GKGeoObject

Inherited by: GKSectionObject, GKVMS, GKPedestrianCrossing, GKMetering, GKDetector, GKDetectorStation, GKBusStop, GKRoute, GKSubPath, GKPublicLine, GKODRoute, GKPolyline, GKPolygon, GKSuperNode, GKSimulationArea, GKProblemNet, GKPolygonWithHoles, GKPTZone, GKPTStation, GKGroup, GKExtrudedPolygon, GKCrosswalkArea, GKCentroid, GKImage3D, GKExtrudedPolyline, GKBezierCurve, GKTurning, GKSuperNodeTrajectory, GKSection, GKObjectConnection, GKCenConnection, GKLayer, GKDPoint, GKText, GKNode, GKImage, GKGeoImage, GKController, GKCircle

Synopsis

Methods

Virtual methods

Note

This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE

class GKGeoContainer

See doGetContainedWay

__init__()
__init__(arg__1)
Parameters:

arg__1GKGeoObject

acceptConnection(object)
Parameters:

objectGKGeoObject

Return type:

bool

Returns true if a connection to this object will be accepted. The current implementation will return true if no other connection to “object” exists (so no repeated connections are allowed).

addConnection(connection)
Parameters:

connectionGKObjectConnection

Adds a connection. The connection object is adopted

addMark(newMark)
Parameters:

newMark – int

Add a new mark to the object keeping the rest.

addTopObject(atopObject)
Parameters:

atopObjectGKGeoObject

Over objects: An object can have other objects always over it as for instance sections have always detectors over it. If an object is over another, it will be drawn immediately after the “bottom” object because the GKGeoModel (and the associated Views) will take care of this requirement.

This method will call atopObject->setBottomObject( this ) (that is, it will set the bottom object of the top object).

anyConnection(target)
Parameters:

targetGKGeoObject

Return type:

bool

Returns true if there are any connection between this object and target

anyConnection(target, connectionType)
Parameters:
Return type:

bool

Returns true if there are any connection of the specified connectionType between this object and target.

canBeGrouped()
Return type:

bool

Can this object be grouped? Usually true unless it is already grouped.

changeConnectionObject(oldObject, newObject[, connectionType=GK.eConnectionUndefined])
Parameters:

Replace “oldObject” by “newObject” in all the connections that are of the specified connectionType. * If connectionType is eConnectionUndefined , all matching connections will be affected.

containsTopObject(atopObject)
Parameters:

atopObjectGKGeoObject

Return type:

bool

Returns true if this objects is in the top objects list.

doGetContainedWay(myBBox, points, bboxPoints)
Parameters:
Return type:

GKGeoContainer

If this object is totally inside the polygon (points) it returns eTotally ; if this object is totally outside the polygon it returns eNothing ; if this object is partially inside and partially outside it returns ePartially . The default implementation does this: * if all the corners of the object bounding box are inside points, eTotally * if any corner of the object bounding box is inside points, ePartially * if any corner of bboxPoints is inside the object bounding box, ePartially * else eNothing

getAltitude()
Return type:

float

Get the altitude of this object (the minimum Z among all the possible Z of the object)

getBBox()
Return type:

GKBBox

Gets the bbox of this object. The default implementation returns an undefined GKBBox .

getBottomObject()
Return type:

GKGeoObject

Any “top” object has one (and only one) object that is “under” it (the bottom object)

getConnections()
Return type:

.QSetGKObjectConnection

Returns all the connections to this object

getConnections(targetType)
Parameters:

targetTypeGKType

Return type:

.QSetGKObjectConnection

Returns all the connections between this object and objects of the provided type

getConnections(target)
Parameters:

targetGKGeoObject

Return type:

.QSetGKObjectConnection

Returns all the connections between this object and target

getConnections(target, connectionType)
Parameters:
Return type:

.QSetGKObjectConnection

Returns all the connections between this object and target with a specific connectionType between this object and target.

getContainedWay(points, bboxPoints)
Parameters:
Return type:

GKGeoContainer

Deprecated function, use doGetContainedWay . The current implementation calls doGetContainedWay ( getBBox() , points, bboxPoints).

getCutCmd(from, to, keepConnection)
Parameters:
Return type:

GKGeoObjectCutCmd

Returns a command for a cut operation. Note that not all the geo objects can be cut, so they will return NULL. An object can return NULL also if it cannot be cut due to some state (is locked for example). This functions receives the segment uses to cut the object.

getLayer()
Return type:

GKLayer

Get the layer in where this object is…

getMark()
Return type:

int

Is the object marked?… 0 means that the object is not marked, any value greater than 0 means that is marked.

An object marked appears in a different color Used, for example, to show what sections pertains to a route. A Mark is a integer, allowing to mark different objects with different marks and show all togethers (for example mark=1 is they are in a route, mark=0 is they are not, mark=2 is they are in two routes…)

This method returns the first (if any) mark on the object.

getMark(pos)
Parameters:

pos – int

Return type:

int

When an objects has more than one mark, return the mark at “pos” (from 0 to N-1, where N is the number of marks). If no mark is available at that position (or at all) it will return 0.

getMarks()
Return type:

QList

Gets all the marks of the object. A NULL vector means no mark.

getNumberOfMarks()
Return type:

int

Returns the number of marks in the object.

getTopObjects()
Return type:

QSet

Returns all the top objects. Can be NULL, means no top objects

isLabeled()
Return type:

bool

Is this object labeled? See setLabeled

isSelected()
Return type:

bool

Is the object selected?… Note that is selected by model and not by view. This means that a selected object will appear selected in all the views.

objectConnectionType([object=None])
Parameters:

objectGKGeoObject

Return type:

ConnectionType

Returns the connection type between this object and the specified one. If the specified object is NULL, all connections will be considered.

removeAllConnections(deleteObjects)
Parameters:

deleteObjectsObjectDeletionBehaviour

Removes all the connections.

removeConnection(connection[, deleteObject=GK.eDoNotDeleteObjects])
Parameters:

Removes a connection. The connection object is NOT deleted

removeTopObject(atopObject)
Parameters:

atopObjectGKGeoObject

Return type:

bool

Removes atopobject from the list of top objects. The object is not deleted and the bottom object at atopobject is not changed (it will keep a pointer to “this”).

Returns true if the object was found and removed and false (object not found) otherwise.

rotate(arg__1, arg__2)
Parameters:
  • arg__1GKPoint

  • arg__2 – float

Rotates the object an angle in radians around the center of rotation

scale(arg__1)
Parameters:

arg__1GKPoint

Scales an object in the X, Y and Z

setAltitude(value)
Parameters:

value – float

Changes the altitude of this object setting the minimum Z to “value” (and moving the rest of the points to z = value - getAltitude() )

setLabeled(value)
Parameters:

value – bool

Sets this object as labeled: a label will appear over it. By default the label contains the ID and name of the object but it can be customized using the geo model preferences. This customization is per type.

The drawer will get the specific label from the G2DDrawer::getObjectLabel method.

See also

isLabeled()

setLayer(alayer)
Parameters:

alayerGKLayer

Set the layer of this object. Note tha t this operation will NOT change the object from a layer to another. In order to do so use functions in the GKGeoModel class. The GKGeoModel class will take care of removing the object from one layer and inserting into another.

setMark(newMark)
Parameters:

newMark – int

Mark an object using the first mark. See getMark for details.

If newMark is 0 then the object will be unmarked.

setSelected(newState)
Parameters:

newState – bool

Is the object selected?… Note that is selected by model and not by view. This means that a selected object will appear selected in all the view.

See also

isSelected()

translate(arg__1)
Parameters:

arg__1GKPoint

Translates an object using a delta

translateFromCS(arg__1)
Parameters:

arg__1 – str

Translates an object from a Coordinate System

unmark()

Removes any mark in the object