SMTK
@SMTK_VERSION@
Simulation Modeling Tool Kit
|
Methods that handle translation between polygon and SMTK instances. More...
#include <Session.h>
Public Types | |
typedef smtk::model::SessionInfoBits | SessionInfoBits |
Public Member Functions | |
smtkTypeMacro (Session) | |
smtkSuperclassMacro (smtk::model::Session) | |
smtkSharedFromThisMacro (smtk::model::Session) | |
smtkCreateMacro (smtk::model::Session) | |
~Session () override | |
Virtual destructor. Here because Session overrides virtual methods from Session. | |
Session (const Session &)=delete | |
Session & | operator= (const Session &)=delete |
SessionInfoBits | allSupportedInformation () const override |
The polygon session supports smtk::model::SESSION_EVERYTHING. | |
template<typename T , typename U , typename V > | |
void | consistentInternalDelete (T &container, U &modified, V &expunged, bool logDebug) |
std::string | defaultFileExtension (const smtk::model::Model &) const override |
Return a filename extension (including ".") appropriate for saving model. More... | |
internal::EntityIdToPtr::iterator | beginStorage () |
internal::EntityIdToPtr::iterator | endStorage () |
internal::EntityIdToPtr::const_iterator | beginStorage () const |
internal::EntityIdToPtr::const_iterator | endStorage () const |
void | addStorage (const smtk::common::UUID &uid, smtk::session::polygon::internal::entity::Ptr storage) |
bool | removeStorage (const smtk::common::UUID &uid) |
Public Member Functions inherited from smtk::model::Session | |
smtkTypeMacroBase (smtk::model::Session) | |
smtkSuperclassMacro (smtk::model::Session) | |
smtkCreateMacro (smtk::model::Session) | |
virtual std::string | name () const |
Return the name of the session type (i.e., the name of the modeling kernel). More... | |
virtual std::string | className () const |
smtk::common::UUID | sessionId () const |
Return the session ID for this instance of the session. More... | |
int | transcribe (const EntityRef &entity, SessionInfoBits flags, bool onlyDangling=true, int depth=-1) |
Transcribe an entity from a foreign modeler into an SMTK storage Resource. More... | |
const DanglingEntities & | danglingEntities () const |
Return the map from dangling entityrefs to bits describing their partial transcription state. | |
void | declareDanglingEntity (const EntityRef &ent, SessionInfoBits present=0) |
Mark an entity, ent, as partially transcribed. More... | |
virtual int | setup (const std::string &optName, const StringList &optVal) |
Set configuration options on the session. More... | |
ResourcePtr | resource () const |
Return a reference to the resource that owns this Session. | |
smtk::io::Logger & | log () |
Return the log (obtained from the model resource). | |
virtual bool | splitEntity (const EntityRef &from, const EntityRefs &to) const |
virtual bool | mergeEntities (const EntityRefs &from, EntityRef &to) const |
virtual bool | splitAttributes (const EntityRef &from, const EntityRefs &to) const |
Called when an entity is being split so that attribute assignments can be updated. More... | |
virtual bool | mergeAttributes (const EntityRefs &from, EntityRef &to) const |
Called when an entity is being split so that attribute assignments can be updated. More... | |
virtual bool | removeGeneratedProperties (const EntityRef &ent, SessionInfoBits propFlags) |
This is used by the resource when erasing a model entity. More... | |
virtual bool | splitProperties (const EntityRef &from, const EntityRefs &to) const |
Called when an entity is being split or cut into one or more descendants. More... | |
virtual bool | mergeProperties (const EntityRefs &from, EntityRef &to) const |
Called when one or more entities are being merged or joined into a descendant. More... | |
Protected Member Functions | |
Session () | |
Default constructor. | |
smtk::model::SessionInfoBits | transcribeInternal (const smtk::model::EntityRef &entity, SessionInfoBits requestedInfo, int depth=-1) override |
Transcribe information requested by flags into entity from foreign modeler. More... | |
bool | removeFaceReferences (const smtk::model::Face &f) |
Remove all references to face from the polygon-session internal storage. More... | |
bool | removeEdgeReferences (const smtk::model::Edge &e) |
Remove all references to edge from the polygon-session internal storage. More... | |
bool | removeVertReferences (const smtk::model::Vertex &v) |
Remove all references to v from the polygon-session internal storage. More... | |
template<typename T > | |
T::Ptr | findStorage (const smtk::common::UUID &uid) |
template<typename T > | |
T | findOrAddStorage (const smtk::common::UUID &uid) |
smtk::model::SessionIOPtr | createIODelegate (const std::string &format) override |
Subclasses may override this method to export additional state. More... | |
internal::EntityIdToPtr::iterator | findStorageIterator (const smtk::common::UUID &uid) |
Protected Member Functions inherited from smtk::model::Session | |
Session () | |
Default constructor. This assigns a random session ID to each Session instance. | |
void | setSessionId (const smtk::common::UUID &sessId) |
Set the session ID. More... | |
void | setResource (Resource *resource) |
Inform this instance of the session that it is owned by resource. | |
virtual EntityPtr | addEntityRecord (const EntityRef &entRef) |
Subclasses implement this; it should add a record for entRef to the resource. | |
virtual ArrangementHelper * | createArrangementHelper () |
Subclasses implement this; it should return a new ArrangementHelper subclass instance. More... | |
int | findOrAddRelatedEntities (const EntityRef &entRef, SessionInfoBits flags, ArrangementHelper *helper) |
Recursively called by transcribeInternal until no new entities are encountered. | |
virtual int | findOrAddCellAdjacencies (const CellEntity &entRef, SessionInfoBits request, ArrangementHelper *helper) |
Subclasses implement this; it should add boundary, bounding, embedded, and embeddor cells of the current cell. | |
virtual int | findOrAddCellUses (const CellEntity &entRef, SessionInfoBits request, ArrangementHelper *helper) |
Subclasses implement this; it should add use records of the current cell. | |
virtual int | findOrAddOwningCell (const UseEntity &entRef, SessionInfoBits request, ArrangementHelper *helper) |
Subclasses implement this; it should add the current use's owning cell. | |
virtual int | findOrAddShellAdjacencies (const UseEntity &entRef, SessionInfoBits request, ArrangementHelper *helper) |
Subclasses implement this; it should add shells bounded by or bounding the given use. | |
virtual int | findOrAddUseAdjacencies (const ShellEntity &entRef, SessionInfoBits request, ArrangementHelper *helper) |
virtual int | findOrAddGroupOwner (const Group &entRef, SessionInfoBits request, ArrangementHelper *helper) |
virtual int | findOrAddFreeCells (const Model &entRef, SessionInfoBits request, ArrangementHelper *helper) |
virtual int | findOrAddRelatedModels (const Model &entRef, SessionInfoBits request, ArrangementHelper *helper) |
virtual int | findOrAddPrototype (const Instance &entRef, SessionInfoBits request, ArrangementHelper *helper) |
virtual int | findOrAddRelatedModels (const SessionRef &entRef, SessionInfoBits request, ArrangementHelper *helper) |
virtual int | findOrAddRelatedGroups (const EntityRef &entRef, SessionInfoBits request, ArrangementHelper *helper) |
virtual int | findOrAddRelatedInstances (const EntityRef &entRef, SessionInfoBits request, ArrangementHelper *helper) |
virtual SessionInfoBits | findOrAddArrangements (const EntityRef &entRef, EntityPtr entRec, SessionInfoBits flags, ArrangementHelper *helper) |
Subclasses implement this to finalize arrangement information for entRef using the helper. | |
virtual SessionInfoBits | updateProperties (const EntityRef &entRef, EntityPtr entRec, SessionInfoBits flags, ArrangementHelper *helper) |
Subclasses implement this to update transcribed (not user-specified) properties of entRef. | |
virtual SessionInfoBits | updateTessellation (const EntityRef &entRef, SessionInfoBits flags, ArrangementHelper *helper) |
Sublasses implement this to update the tessellation of the given entRef. More... | |
Protected Attributes | |
internal::EntityIdToPtr | m_storage |
int | m_nextModelNumber { 0 } |
Protected Attributes inherited from smtk::model::Session | |
DanglingEntities | m_dangling |
smtk::common::UUID | m_sessionId |
Resource * | m_resource { nullptr } |
Friends | |
class | Neighborhood |
class | Operation |
class | Resource |
class | internal::pmodel |
class | SessionIOJSON |
Additional Inherited Members | |
Static Public Member Functions inherited from smtk::model::Session | |
static std::string | staticClassName () |
Methods that handle translation between polygon and SMTK instances.
While the TDUUID class keeps a map from SMTK UUIDs to polygon ToolDataUser pointers, this is not enough to handle everything SMTK provides: there is no way to track cell-use or shell entities since they do not inherit ToolDataUser instances. Also, some engines (e.g., facet) do not appear to store some entity types (e.g., RefGroup).
Also, simply loading a polygon file does not translate the entire model into SMTK; instead, it assigns UUIDs to entities if they do not already exist. This class (Session) provides a method for requesting the entity, arrangement, and/or tessellation information for a UUID be mapped into SMTK from polygon.
|
overrideprotectedvirtual |
Subclasses may override this method to export additional state.
Importers (e.g., LoadJSON) and exporters (e.g., SaveJSON) will call this method to obtain a session I/O class instance specific to the given format. If a valid SessionIO shared-pointer is returned, it will be dynamically cast to a format-specific subclass and given the opportunity to provide additional information to be imported/exported to/from the session.
This default implementation is provided since most sessions will not need additional state.
Reimplemented from smtk::model::Session.
|
overridevirtual |
Return a filename extension (including ".") appropriate for saving model.
Subclasses of session should override this method. If a method returns the empty string, it indicates that the model requires no "native" model file. (The polygon session is an example of this where all information is saved in the SMTK file.)
Reimplemented from smtk::model::Session.
|
protected |
Remove all references to edge from the polygon-session internal storage.
Note that this must be called before edge is removed from the SMTK model resource since it uses information in the model resource to obtain the list of vertices bounding the edge.
|
protected |
Remove all references to face from the polygon-session internal storage.
Note that this must be called before face is removed from the SMTK model resource since it uses information in the model resource to obtain the list of vertices bounding the face.
|
protected |
Remove all references to v from the polygon-session internal storage.
This will emit an error and return false if the vertex has any incident edges. It is otherwise identical to calling removeStorage(v .entity()).
|
overrideprotectedvirtual |
Transcribe information requested by flags into entity from foreign modeler.
This method should return a non-zero value upon success. Upon success, flags should be modified to represent the actual information transcribed (as opposed to what was requested). This should always be at least the information requested but may include more information.
Currently, it really only makes sense to call this method on a Model (i.e., not an edge, face, etc.); entire models at a time are retranscribed.
Subclasses may override this method. If they do not, they should implement the virtual relationship helper methods.
Reimplemented from smtk::model::Session.