I am writing application where user will be able to draw network of processing elements and make real time simulation.
In this situation it is very important to know which connection point from one shape is connected to which connection point of second shape (connection point id would be ideal).
Connection line parameters (wxSFLineShape) contain information about absolute position of source and target points (GetSrcPoint and GetTrgPoint).
Can we obtain information about source connection point (id) and target connection point (id) within source and target shape ?
How to serialize this information to obtain xml file with connection line properties that contain data about source and target shape (which already exists) and id's of connections of source and destination shapes?
For each connection line I need this information:
Connection Line
Source - SourceConnectionId - Target - TargetConnectionId
Is there any simple or already implemented way to do this, I suppose I missed something?
Thank you in advanced,
Aleksandar
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
For (1), unfortunately I don't think there is a simple way (although I agree it would be nice), but it is possible as follows:
Create your own connection points with pre-determined IDs - see wxSFShapeBase::AddConnectionPoint (const wxRealPoint& relpos, long id = -1, bool persistent = true).
Add connections manually using wxSFDiagramManager::CreateConnection (long srcId, long trgId, wxClassInfo lineInfo, bool saveState = true, wxSF::ERRCODE err = NULL)
This will connect the shapes, but you need to adjust the connections to your custom connection points, use wxSFLineShape::SetStartingConnectionPoint and wxSFLineShape::SetEndingConnectionPoint to do this.
You could subclass wxSFLineShape to cache the information that you need.
With regard to (2), sorry but I haven't got any experience with the serializer. I think it is possible though, take a look at the wxXmlSerializer class and I think you can adapt your custom class discussed in (1) to serialize along with the standard classes.
Last edit: iwbnwif 2014-09-01
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am writing application where user will be able to draw network of processing elements and make real time simulation.
In this situation it is very important to know which connection point from one shape is connected to which connection point of second shape (connection point id would be ideal).
Connection line parameters (wxSFLineShape) contain information about absolute position of source and target points (GetSrcPoint and GetTrgPoint).
Can we obtain information about source connection point (id) and target connection point (id) within source and target shape ?
How to serialize this information to obtain xml file with connection line properties that contain data about source and target shape (which already exists) and id's of connections of source and destination shapes?
For each connection line I need this information:
Connection Line
Source - SourceConnectionId - Target - TargetConnectionId
Is there any simple or already implemented way to do this, I suppose I missed something?
Thank you in advanced,
Aleksandar
For (1), unfortunately I don't think there is a simple way (although I agree it would be nice), but it is possible as follows:
With regard to (2), sorry but I haven't got any experience with the serializer. I think it is possible though, take a look at the wxXmlSerializer class and I think you can adapt your custom class discussed in (1) to serialize along with the standard classes.
Last edit: iwbnwif 2014-09-01
Sorry I should add that wxSFLineShape::GetSrcShapeId and wxSFLineShape::GetTrgShapeId will get the shapes.