Aimsun Next Scripting  22
Public Types | Public Member Functions | Static Public Attributes | List of all members
G2DView Class Reference
Inheritance diagram for G2DView:
GView

Public Types

enum  eDPIToUse { eHorizontalDPI , eVerticalDPI }
 
- Public Types inherited from GView
enum  GKHitModifier { eAll , eSelected , eUnselected }
 
enum  GKFloatingStringRelativePos {
  eAuto , eCenter , eLeft , eRight ,
  eTop , eBottom
}
 

Public Member Functions

 G2DView (QWidget *, const QString &=QString())
 
 ~G2DView ()
 
QWidget * getWidget ()
 
void invalidate ()
 
void selectAll ()
 
void inverseSelection ()
 
void setWorld (const GKBBox &)
 
const GKBBoxgetViewArea () const
 
const GKBBoxgetWorld () const
 
GKBBox minBBox () const
 
GKCoord getZoom () const
 
GKPoint screen2World (const QPointF &) const
 
double unit2Pixel (GKCoord, eDPIToUse=eHorizontalDPI) const
 
GKCoord pixel2Unit (int, eDPIToUse=eHorizontalDPI) const
 
void zoom (GKCoord)
 
void zoom (GKCoord, const GKPoint &)
 
void zoom (const GKBBox &)
 
void pan (const GKPoint &)
 
void panToObject (const GKGeoObject *)
 
void centerWorld ()
 
void wholeWorld ()
 
void wholeArea (const GKBBox &)
 
void moveSelectionToViewCenter ()
 
void centerLayer (GKLayer *)
 
virtual GDrawerHitfindClicked (const QPointF &, GKHitModifier=eAll, bool=false)
 
virtual QVector< GDrawerHit * > multiFindClicked (const QPointF &, GKHitModifier, bool=false)
 
GKGeoObjectfindClosestObject (const GKPoint &p, GKType *type=NULL, double maxDistance=100, double *objDistance=NULL)
 
void setTimeContext (const GKContext &)
 
G2DViewLayerfindLayer (GKLayer *modelLayer, bool recursive=true)
 
bool isMasterView () const
 
void setMasterView (bool)
 
bool isMasterClock () const
 
void setMasterClock (bool value)
 
bool saveSnapshot (const QString &fileName, const char *format, GKBBox area, int width=-1, int height=-1, bool includeLogos=true)
 
bool copySnapshot (int=-1, int=-1)
 
void preferencesChanged ()
 
void cut ()
 
void copy ()
 
void paste ()
 
void clear ()
 
int getScreenWidth () const
 
int getScreenHeight () const
 
void setFilter (GKProblemNet *)
 
void setAttributeForDynamicLabel (GKGeoObject *object, GKColumn *newAttribute)
 
- Public Member Functions inherited from GView
 if (base)
 
Py_END_ALLOW_THREADS End GView (QWidget *parent=0, Qt::WindowFlags fl=Qt::WindowFlags())
 
virtual GDrawerfindDrawer (const GKGeoObject *key) const
 
virtual GDrawerremoveDrawer (const GKGeoObject *key)=0
 
virtual void invalidate ()
 
virtual const QHash< GKGeoObject *, GDrawer * > & getDrawers () const =0
 
virtual GDrawerHitfindClicked (const QPointF &, GKHitModifier=eAll, bool=false)
 
virtual QVector< GDrawerHit * > multiFindClicked (const QPointF &, GKHitModifier, bool=false)
 
virtual GDrawerHitfindClickedByType (const QPointF &p, GKType *type, GKHitModifier=eAll, bool=false)
 
virtual void selectAll ()
 
virtual void inverseSelection ()
 
virtual void populate ()=0
 
GKContextgetTimeContext ()
 
void setTimeContext (const GKContext &)
 
GKViewModegetMode () const
 
virtual void setMode (GKViewMode *)
 
virtual void panToObject (const GKGeoObject *)
 
virtual void setFloatingString (const QString &, const GKPoint &, GKFloatingStringRelativePos=eRight)
 
GGuigetGui ()
 
GKGeoModelgetGeoModel ()
 
GKProblemNetgetFilter () const
 
virtual void setFilter (GKProblemNet *)
 
virtual GKPoint screen2World (const QPointF &) const =0
 
virtual bool saveSnapshot (const QString &, const char *, GKBBox, int=-1, int=-1, bool=true)
 

Static Public Attributes

static int gcSimpleDrawZoomFactor
 

Additional Inherited Members

- Public Attributes inherited from GView
ConvertToSubClassCode Py_BEGIN_ALLOW_THREADS GViewbase = (GView*)( sipCpp )
 
 sipType = 0
 

Detailed Description

A view for 2D objects that can be integrated (but is not mandatory) in a G2DViewWindow.

Member Enumeration Documentation

◆ eDPIToUse

Which DPI to use for world to device transformations.

Enumerator
eHorizontalDPI 
eVerticalDPI 

Constructor & Destructor Documentation

◆ G2DView()

G2DView::G2DView ( QWidget *  ,
const QString &  = QString() 
)

◆ ~G2DView()

G2DView::~G2DView ( )

Member Function Documentation

◆ centerLayer()

void G2DView::centerLayer ( GKLayer )

Pan the view to the center of this layer.

◆ centerWorld()

void G2DView::centerWorld ( )

Centers the world (pan) in the current view

◆ clear()

void G2DView::clear ( )

◆ copy()

void G2DView::copy ( )

◆ copySnapshot()

bool G2DView::copySnapshot ( int  = -1,
int  = -1 
)

◆ cut()

void G2DView::cut ( )

◆ findClicked()

virtual GDrawerHit * G2DView::findClicked ( const QPointF &  ,
GKHitModifier  = eAll,
bool  = false 
)
virtual

Find an object (and only object) in where the point dp its interior to it. The modifier can be used to look only on:

  • select objects
  • unselected objects
  • all the objects, selected or unselected

Also an additional parameter to extend the search to non_editable layers can be specified.

This method stops when it founds the first suitable object. On a 2D View the layer order is used (top layers are used first).

Reimplemented from GView.

◆ findClosestObject()

GKGeoObject * G2DView::findClosestObject ( const GKPoint p,
GKType type = NULL,
double  maxDistance = 100,
double *  objDistance = NULL 
)

Returns the closest object to a point. If a type is specified, only objects of that type will be considered. You can set a maximum distance (in meters) to scan and a variable to get the distance to the returned object

◆ findLayer()

G2DViewLayer * G2DView::findLayer ( GKLayer modelLayer,
bool  recursive = true 
)

Find a layer using its GKLayer (its model).

◆ getScreenHeight()

int G2DView::getScreenHeight ( ) const

Returns the screen height in pixels (from QPaintDeviceMetrics::height )

◆ getScreenWidth()

int G2DView::getScreenWidth ( ) const

Returns the screen width in pixels (from QPaintDeviceMetrics::width )

◆ getViewArea()

const GKBBox & G2DView::getViewArea ( ) const

Current world area visible in the window (in m)

◆ getWidget()

QWidget * G2DView::getWidget ( )

◆ getWorld()

const GKBBox & G2DView::getWorld ( ) const

World coordinates, from and to (in m)

◆ getZoom()

GKCoord G2DView::getZoom ( ) const

Current zoom factor (in m) 1:XX.

◆ invalidate()

void G2DView::invalidate ( )
virtual

Mark this view as invalid, forcing a redrawing.

Reimplemented from GView.

◆ inverseSelection()

void G2DView::inverseSelection ( )
virtual

Inverse the current selection, what is select will be unselected, what is unselected will be selected.

Reimplemented from GView.

◆ isMasterClock()

bool G2DView::isMasterClock ( ) const

Are Clocks Synchronized?

◆ isMasterView()

bool G2DView::isMasterView ( ) const

Is a master view?

◆ minBBox()

GKBBox G2DView::minBBox ( ) const

Minimum BBox for this view...

◆ moveSelectionToViewCenter()

void G2DView::moveSelectionToViewCenter ( )

Translates the current selection making the center of the selection BBOX the same as the center of the current view area.

◆ multiFindClicked()

virtual QVector< GDrawerHit * > G2DView::multiFindClicked ( const QPointF &  ,
GKHitModifier  ,
bool  = false 
)
virtual

Find all the objects in where the point dp its interior to it. The modifier can be used to look only on:

  • select objects
  • unselected objects
  • all the objects, selected or unselected

Also an additional parameter to extend the search to non_editable layers can be specified.

Reimplemented from GView.

◆ pan()

void G2DView::pan ( const GKPoint )

Makes point the center of the visible area

◆ panToObject()

void G2DView::panToObject ( const GKGeoObject )
virtual

Makes the center of the bbox og object key the center of the visible area

Reimplemented from GView.

◆ paste()

void G2DView::paste ( )

◆ pixel2Unit()

GKCoord G2DView::pixel2Unit ( int  ,
eDPIToUse  = eHorizontalDPI 
) const

Converts a size from device coordinates to world coordinates.

◆ preferencesChanged()

void G2DView::preferencesChanged ( )

Read preferences after a change

◆ saveSnapshot()

bool G2DView::saveSnapshot ( const QString &  fileName,
const char *  format,
GKBBox  area,
int  width = -1,
int  height = -1,
bool  includeLogos = true 
)
virtual

Save a snapshot of this view in a file. The size of the image is either width and height or the current size of the view (if width or height are equal to -1).

  • If area is undefined takes a snap of the whole network
  • If area with and heifg are 0 takes a snap of the current view area
  • If the area is valid it takes a snap fo the area.

Reimplemented from GView.

◆ screen2World()

GKPoint G2DView::screen2World ( const QPointF &  ) const
virtual

Converts a point from device coordinates to world coordinates.

Implements GView.

◆ selectAll()

void G2DView::selectAll ( )
virtual

Select all the objects in the geo model. Note that this selection if per geo model and not per view (objects selected in this view are selected in the rest of the views too).

Reimplemented from GView.

◆ setAttributeForDynamicLabel()

void G2DView::setAttributeForDynamicLabel ( GKGeoObject object,
GKColumn newAttribute 
)
  • Modifies the attribute of a dynamic label of an object. Requirements: A dynamic label must already exist for the object. It is recommended that only one dynamic label exists as all the existing one will change to new attribute. *‍/

◆ setFilter()

void G2DView::setFilter ( GKProblemNet )
virtual

Restrict the draw of objects to the ones that are inside a subnetwork (if NULL everything will be draw).

Reimplemented from GView.

◆ setMasterClock()

void G2DView::setMasterClock ( bool  value)

◆ setMasterView()

void G2DView::setMasterView ( bool  )

◆ setTimeContext()

void G2DView::setTimeContext ( const GKContext )

◆ setWorld()

void G2DView::setWorld ( const GKBBox )

Set the maximum and minimum coordinates for this view. Done by G2DView::setGui when creating the drawers from the geo model. Its called also by the slot G2DView::worldResized when the world is resized because a new object has been add.

◆ unit2Pixel()

double G2DView::unit2Pixel ( GKCoord  ,
eDPIToUse  = eHorizontalDPI 
) const

Converts a size from world coordinates to device coordinates.

◆ wholeArea()

void G2DView::wholeArea ( const GKBBox )

Centers the area in the view and changes the zoom to ensure its complete vissibility.

◆ wholeWorld()

void G2DView::wholeWorld ( )

Centers the world in the view and changes the zoom to ensure its complete vissibility.

◆ zoom() [1/3]

void G2DView::zoom ( const GKBBox )

Changes the current drawing scale and pan so that the center of "area" is the center of the view and "area" is totally visible and, if possible, the current view shows only the "area".

◆ zoom() [2/3]

void G2DView::zoom ( GKCoord  )

Changes the current drawing scale. The point in the center of the visible area will remain the center after the operation.

◆ zoom() [3/3]

void G2DView::zoom ( GKCoord  ,
const GKPoint  
)

Changes the current drawing scale. The point panPoint will keep its XY coordinates in device space (that is, it will be in the same relative location)

Member Data Documentation

◆ gcSimpleDrawZoomFactor

int G2DView::gcSimpleDrawZoomFactor
static

Defines the zoom factor limit from where the objects will be drawn as simple or complex. With a zoom factor greater that this value the object will be drawn as complex and with a value lower that this factor it will be drawn as simple

© Aimsun SLU
Aimsun ®