C# 클래스 Dynamo.Graph.Workspaces.WorkspaceModel

Represents base class for all kind of workspaces which contains general data such as Name, collections of nodes, notes, annotations, etc.
상속: Dynamo.Core.NotificationObject, ILocatable, IUndoRedoRecorderClient, ILogSource, IDisposable, IWorkspaceModel
파일 보기 프로젝트 열기: DynamoDS/Dynamo 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
NodeFactory NodeFactory

보호된 프로퍼티들

프로퍼티 타입 설명
guid Guid

Private Properties

프로퍼티 타입 설명
AddAndRegisterNode void
AddAnnotation AnnotationModel
AddAnnotation void
AddNewAnnotation void
AddNode void
AddNote NoteModel
AddNote void
AddNote void
AddPreset PresetModel
AddPresetCore PresetModel
ApplyPreset void
AvoidSubgraphOverlap void
CheckIfModelExistsInSameGroup bool
ClearAnnotations void
ClearNodes void
ClearNotes void
ClearUndoRecorder void
ComputeUpstreamCacheForEntireGraph void
ConvertNodesToCodeInternal void
DoGraphAutoLayout void
GenerateCombinedGraph void
GenerateSeparateSubgraphs void
GetHangingNodes IEnumerable
GetModelsInternal IEnumerable
GetSourceNodes IEnumerable
GetStringRepOfWorkspace string
IncrementPasteOffset void
IsInternalNodeToCodeConnection bool
OnCurrentOffsetChanged void
OnRequestNodeCentered void
OnSyncWithDefinitionEnd void
OnSyncWithDefinitionStart void
OnZoomChanged void
ReConnectInputConnections List
ReConnectOutputConnections List
RecordAndDeleteModels void
RecordCreatedModel void
RecordCreatedModels void
RecordGroupModelBeforeUngroup void
RecordModelForModification void
RecordModelsForModification void
RecordModelsForUndo void
RecordUndoGraphLayout void
Redo void
RegisterConnector void
RemoveAndDisposeNode void
RemoveAnnotation void
RemoveNote void
ResetWorkspace void
RunLayoutSubgraph void
SaveInternal bool
SaveLayoutGraph void
SendModelEvent void
SerializeElementResolver void
SetModelEventOnAnnotation void
ShouldProceedWithRecording bool
ShouldProceedWithRecording bool
Undo void
UpdateModelValue void
annotationModel_GetModelBase ModelBase
computeUpstreamNodesWhenWorkspaceAdded void

공개 메소드들

메소드 설명
Clear ( ) : void

Clears this workspace of nodes, notes, and connectors.

CreateModel ( XmlElement modelData ) : void

Creates ModelBase object by given xml data and adds it to corresponding collection of the workspace.

DeleteModel ( XmlElement modelData ) : void

Deletes ModelBase object given by XmlElement from a corresponding collection of the workspace.

Dispose ( ) : void

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

GetModelForElement ( XmlElement modelData ) : Dynamo.Models.ModelBase

Gets model by GUID which is contained in given Xml data.

GetModelInternal ( System.Guid modelGuid ) : Dynamo.Models.ModelBase

Returns model by GUID

GetSharedName ( ) : string

Returns appropriate name of workspace for sharing.

ImportPresets ( IEnumerable presetCollection ) : void

Adds a specified collection PresetModel objects to the preset collection of the workspace.

RecordModelsForModification ( IEnumerable models ) : void

Implement recording node modification for undo/redo.

ReloadModel ( XmlElement modelData ) : void

Updates ModelBase object with given xml data

RemoveGroup ( Dynamo.Models.ModelBase model ) : void

Deletes AnnotationModel object from annotation collection of the workspace.

RemovePreset ( PresetModel state ) : void

Removes a specified PresetModel object from the preset collection of the workspace.

ReportPosition ( ) : void

Called when workspace position is changed. This method notifyies all the listeners when a workspace is changed.

Save ( ProtoCore runtimeCore ) : bool

Save assuming that the Filepath attribute is set.

SaveAs ( string newPath, ProtoCore runtimeCore, bool isBackup = false ) : bool

Save to a specific file path, if the path is null or empty, does nothing. If successful, the CurrentWorkspace.FilePath field is updated as a side effect

보호된 메소드들

메소드 설명
DisposeNode ( Dynamo.Models.NodeModel node ) : void
Log ( ILogMessage obj ) : void
Log ( string msg ) : void
Log ( string msg, WarningLevel severity ) : void
NodeModified ( Dynamo.Models.NodeModel node ) : void

Indicates that the AST for a node in this workspace requires recompilation

OnAnnotationAdded ( AnnotationModel annotation ) : void
OnAnnotationRemoved ( AnnotationModel annotation ) : void
OnAnnotationsCleared ( ) : void
OnConnectorAdded ( ConnectorModel obj ) : void
OnConnectorDeleted ( ConnectorModel obj ) : void
OnNodeAdded ( Dynamo.Models.NodeModel node ) : void
OnNodeRemoved ( Dynamo.Models.NodeModel node ) : void
OnNodesCleared ( ) : void
OnNoteAdded ( NoteModel note ) : void
OnNoteRemoved ( NoteModel note ) : void
OnNotesCleared ( ) : void
OnSaving ( XmlDocument obj ) : void
OnToggleNodeFreeze ( Dynamo.Models.NodeModel obj ) : void
OnWorkspaceSaved ( ) : void
PopulateXmlDocument ( XmlDocument xmlDoc ) : bool
RegisterNode ( Dynamo.Models.NodeModel node ) : void
RequestRun ( ) : void
ResetWorkspaceCore ( ) : void

Derived workspace classes can choose to override this method to perform clean-up specific to them.

SerializeSessionData ( XmlDocument document, ProtoCore runtimeCore ) : void
WorkspaceModel ( IEnumerable nodes, IEnumerable notes, IEnumerable annotations, WorkspaceInfo info, NodeFactory factory, IEnumerable presets, ElementResolver resolver ) : Dynamo.Core

비공개 메소드들

메소드 설명
AddAndRegisterNode ( Dynamo.Models.NodeModel node, bool centered = false ) : void

Adds a node to this workspace.

AddAnnotation ( string text, System.Guid id ) : AnnotationModel
AddAnnotation ( AnnotationModel annotationModel ) : void
AddNewAnnotation ( AnnotationModel annotation ) : void
AddNode ( Dynamo.Models.NodeModel node ) : void
AddNote ( bool centerNote, double xPos, double yPos, string text, System.Guid id ) : NoteModel
AddNote ( NoteModel note ) : void
AddNote ( NoteModel note, bool centered ) : void
AddPreset ( string name, string description, IEnumerable IDSToSave ) : PresetModel
AddPresetCore ( string name, string description, IEnumerable currentSelection ) : PresetModel

this method creates a new preset state from a set of NodeModels and adds this new state to this presets collection

ApplyPreset ( PresetModel state ) : void
AvoidSubgraphOverlap ( ) : void

This method repeatedly shifts subgraphs away vertically from each other when there are any two nodes from different subgraphs overlapping.

CheckIfModelExistsInSameGroup ( IEnumerable selectNodes, IEnumerable selectNotes ) : bool

Checks if model exists in same group.

ClearAnnotations ( ) : void
ClearNodes ( ) : void
ClearNotes ( ) : void
ClearUndoRecorder ( ) : void
ComputeUpstreamCacheForEntireGraph ( ) : void

This method ensures that all upstream node caches are correct by calling ComputeUpstreamOnDownstream on all source nodes in the graph, this is done in such a way that each node is only computed once.

ConvertNodesToCodeInternal ( Dynamo.Engine.EngineController engineController, INamingProvider namingProvider ) : void
DoGraphAutoLayout ( ) : void

This function wraps a few methods on the workspace model layer to set up and run the graph layout algorithm.

GenerateCombinedGraph ( bool isGroupLayout ) : void

This method extracts all models from the workspace and puts them into the combined graph object, LayoutSubgraphs.First() True if all the selected models are groups.

GenerateSeparateSubgraphs ( HashSet nodes ) : void

This method repeatedly takes a selected node in the combined graph and uses breadth-first search to find all other nodes in the same subgraph until all selected nodes have been processed.

GetHangingNodes ( ) : IEnumerable
GetModelsInternal ( IEnumerable modelGuids ) : IEnumerable

Gets model list by their GUIDs

GetSourceNodes ( ) : IEnumerable

Returns the nodes in the graph that have no inputs or have none of their inputs filled

GetStringRepOfWorkspace ( ) : string
IncrementPasteOffset ( ) : void

Increment the current paste offset to prevent overlapping pasted elements

IsInternalNodeToCodeConnection ( IEnumerable nodes, ConnectorModel connector ) : bool

Checks whether the given connection is inside the node to code set or outside it. This determines if it should be redrawn(if it is external) or if it should be deleted (if it is internal)

OnCurrentOffsetChanged ( object sender, Dynamo.Models.PointEventArgs e ) : void

Used during open and workspace changes to set the location of the workspace

OnRequestNodeCentered ( object sender, Dynamo.Models.ModelEventArgs e ) : void

Requests that a Node or Note model should be centered.

OnSyncWithDefinitionEnd ( Dynamo.Models.NodeModel nodeModel ) : void
OnSyncWithDefinitionStart ( Dynamo.Models.NodeModel nodeModel ) : void
OnZoomChanged ( object sender, Dynamo.Models.ZoomEventArgs e ) : void

Used during open and workspace changes to set the zoom of the workspace

ReConnectInputConnections ( string>.Dictionary externalInputConnections, CodeBlockNodeModel cbn ) : List

Forms new connections from the external nodes to the Node To Code Node, based on the connectors passed as inputs.

ReConnectOutputConnections ( string>.Dictionary externalOutputConnections, CodeBlockNodeModel cbn ) : List

Forms new connections from the external nodes to the Node To Code Node, based on the connectors passed as inputs.

RecordAndDeleteModels ( List models ) : void
RecordCreatedModel ( Dynamo.Models.ModelBase model ) : void
RecordCreatedModels ( List models ) : void
RecordGroupModelBeforeUngroup ( AnnotationModel annotation ) : void
RecordModelForModification ( Dynamo.Models.ModelBase model, Dynamo.Core.UndoRedoRecorder recorder ) : void
RecordModelsForModification ( List models, Dynamo.Core.UndoRedoRecorder recorder ) : void

TODO(Ben): This method is exposed this way for external codes (e.g. the DragCanvas) to record models before they are modified. This is by no means ideal. The ideal case of course is for ALL codes that end up modifying models to be folded back into WorkspaceViewModel in the form of commands. These commands then internally record those affected models before updating them. We need this method to be gone sooner than later.

RecordModelsForUndo ( UndoRedoRecorder.UserAction>.Dictionary models, Dynamo.Core.UndoRedoRecorder recorder ) : void
RecordUndoGraphLayout ( bool isGroupLayout ) : void

This method adds relevant models to the undo recorder.

Redo ( ) : void
RegisterConnector ( ConnectorModel connector ) : void
RemoveAndDisposeNode ( Dynamo.Models.NodeModel model, bool dispose = true ) : void

Removes a node from this workspace. This method does not raise a NodesModified event. (LC notes this is clearly not true)

RemoveAnnotation ( AnnotationModel annotation ) : void
RemoveNote ( NoteModel note ) : void
ResetWorkspace ( ) : void
RunLayoutSubgraph ( GraphLayout graph, bool isGroupLayout ) : void

This function calls the graph layout algorithm methods.

SaveInternal ( string targetFilePath, ProtoCore runtimeCore ) : bool
SaveLayoutGraph ( ) : void

This method pushes changes from the GraphLayout.Graph objects back to the workspace models.

SendModelEvent ( System.Guid modelGuid, string eventName, int value ) : void
SerializeElementResolver ( XmlDocument xmlDoc ) : void
SetModelEventOnAnnotation ( ) : void

this sets the event on Annotation. This event return the model from the workspace. When a model is ungrouped from a group, that model will be deleted from that group. So, when UNDO execution, cannot get that model from that group, it has to get from the workspace. The below method will set the event on every annotation model, that will return the specific model from workspace.

ShouldProceedWithRecording ( UndoRedoRecorder.UserAction>.Dictionary models ) : bool
ShouldProceedWithRecording ( List models ) : bool
Undo ( ) : void
UpdateModelValue ( IEnumerable modelGuids, string propertyName, string value ) : void
annotationModel_GetModelBase ( Guid modelGuid ) : ModelBase

Returns the model from Workspace

computeUpstreamNodesWhenWorkspaceAdded ( WorkspacesModificationEventArgs args ) : void

Computes the upstream nodes when workspace is added. when a workspace is added (assuming that all the nodes and its connectors were added successfully) compute the upstream cache for all the frozen nodes.

메소드 상세

Clear() 공개 메소드

Clears this workspace of nodes, notes, and connectors.
public Clear ( ) : void
리턴 void

CreateModel() 공개 메소드

Creates ModelBase object by given xml data and adds it to corresponding collection of the workspace.
public CreateModel ( XmlElement modelData ) : void
modelData System.Xml.XmlElement Xml data to create model
리턴 void

DeleteModel() 공개 메소드

Deletes ModelBase object given by XmlElement from a corresponding collection of the workspace.
public DeleteModel ( XmlElement modelData ) : void
modelData System.Xml.XmlElement object given by
리턴 void

Dispose() 공개 메소드

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public Dispose ( ) : void
리턴 void

DisposeNode() 보호된 메소드

protected DisposeNode ( Dynamo.Models.NodeModel node ) : void
node Dynamo.Models.NodeModel
리턴 void

GetModelForElement() 공개 메소드

Gets model by GUID which is contained in given Xml data.
public GetModelForElement ( XmlElement modelData ) : Dynamo.Models.ModelBase
modelData System.Xml.XmlElement Xml data to find model.
리턴 Dynamo.Models.ModelBase

GetModelInternal() 공개 메소드

Returns model by GUID
public GetModelInternal ( System.Guid modelGuid ) : Dynamo.Models.ModelBase
modelGuid System.Guid Identifier of the requested model.
리턴 Dynamo.Models.ModelBase

GetSharedName() 공개 메소드

Returns appropriate name of workspace for sharing.
public GetSharedName ( ) : string
리턴 string

ImportPresets() 공개 메소드

Adds a specified collection PresetModel objects to the preset collection of the workspace.
public ImportPresets ( IEnumerable presetCollection ) : void
presetCollection IEnumerable objects to add.
리턴 void

Log() 보호된 메소드

protected Log ( ILogMessage obj ) : void
obj ILogMessage
리턴 void

Log() 보호된 메소드

protected Log ( string msg ) : void
msg string
리턴 void

Log() 보호된 메소드

protected Log ( string msg, WarningLevel severity ) : void
msg string
severity WarningLevel
리턴 void

NodeModified() 보호된 메소드

Indicates that the AST for a node in this workspace requires recompilation
protected NodeModified ( Dynamo.Models.NodeModel node ) : void
node Dynamo.Models.NodeModel
리턴 void

OnAnnotationAdded() 보호된 메소드

protected OnAnnotationAdded ( AnnotationModel annotation ) : void
annotation AnnotationModel
리턴 void

OnAnnotationRemoved() 보호된 메소드

protected OnAnnotationRemoved ( AnnotationModel annotation ) : void
annotation AnnotationModel
리턴 void

OnAnnotationsCleared() 보호된 메소드

protected OnAnnotationsCleared ( ) : void
리턴 void

OnConnectorAdded() 보호된 메소드

protected OnConnectorAdded ( ConnectorModel obj ) : void
obj ConnectorModel
리턴 void

OnConnectorDeleted() 보호된 메소드

protected OnConnectorDeleted ( ConnectorModel obj ) : void
obj ConnectorModel
리턴 void

OnNodeAdded() 보호된 메소드

protected OnNodeAdded ( Dynamo.Models.NodeModel node ) : void
node Dynamo.Models.NodeModel
리턴 void

OnNodeRemoved() 보호된 메소드

protected OnNodeRemoved ( Dynamo.Models.NodeModel node ) : void
node Dynamo.Models.NodeModel
리턴 void

OnNodesCleared() 보호된 메소드

protected OnNodesCleared ( ) : void
리턴 void

OnNoteAdded() 보호된 메소드

protected OnNoteAdded ( NoteModel note ) : void
note NoteModel
리턴 void

OnNoteRemoved() 보호된 메소드

protected OnNoteRemoved ( NoteModel note ) : void
note NoteModel
리턴 void

OnNotesCleared() 보호된 메소드

protected OnNotesCleared ( ) : void
리턴 void

OnSaving() 보호된 메소드

protected OnSaving ( XmlDocument obj ) : void
obj System.Xml.XmlDocument
리턴 void

OnToggleNodeFreeze() 보호된 메소드

protected OnToggleNodeFreeze ( Dynamo.Models.NodeModel obj ) : void
obj Dynamo.Models.NodeModel
리턴 void

OnWorkspaceSaved() 보호된 메소드

protected OnWorkspaceSaved ( ) : void
리턴 void

PopulateXmlDocument() 보호된 메소드

protected PopulateXmlDocument ( XmlDocument xmlDoc ) : bool
xmlDoc System.Xml.XmlDocument
리턴 bool

RecordModelsForModification() 공개 메소드

Implement recording node modification for undo/redo.
public RecordModelsForModification ( IEnumerable models ) : void
models IEnumerable Collection of objects to record.
리턴 void

RegisterNode() 보호된 메소드

protected RegisterNode ( Dynamo.Models.NodeModel node ) : void
node Dynamo.Models.NodeModel
리턴 void

ReloadModel() 공개 메소드

Updates ModelBase object with given xml data
public ReloadModel ( XmlElement modelData ) : void
modelData System.Xml.XmlElement Xml data to update model
리턴 void

RemoveGroup() 공개 메소드

Deletes AnnotationModel object from annotation collection of the workspace.
public RemoveGroup ( Dynamo.Models.ModelBase model ) : void
model Dynamo.Models.ModelBase object to remove.
리턴 void

RemovePreset() 공개 메소드

Removes a specified PresetModel object from the preset collection of the workspace.
public RemovePreset ( PresetModel state ) : void
state PresetModel object to remove.
리턴 void

ReportPosition() 공개 메소드

Called when workspace position is changed. This method notifyies all the listeners when a workspace is changed.
public ReportPosition ( ) : void
리턴 void

RequestRun() 보호된 메소드

protected RequestRun ( ) : void
리턴 void

ResetWorkspaceCore() 보호된 메소드

Derived workspace classes can choose to override this method to perform clean-up specific to them.
protected ResetWorkspaceCore ( ) : void
리턴 void

Save() 공개 메소드

Save assuming that the Filepath attribute is set.
public Save ( ProtoCore runtimeCore ) : bool
runtimeCore ProtoCore The object /// to obtain serialized trace data for node list to save.
리턴 bool

SaveAs() 공개 메소드

Save to a specific file path, if the path is null or empty, does nothing. If successful, the CurrentWorkspace.FilePath field is updated as a side effect
public SaveAs ( string newPath, ProtoCore runtimeCore, bool isBackup = false ) : bool
newPath string The path to save to
runtimeCore ProtoCore The object /// to obtain serialized trace data for node list to save.
isBackup bool Indicates whether saved workspace is backup or not. If it's not backup, /// we should add it to recent files. Otherwise leave it.
리턴 bool

SerializeSessionData() 보호된 메소드

protected SerializeSessionData ( XmlDocument document, ProtoCore runtimeCore ) : void
document System.Xml.XmlDocument
runtimeCore ProtoCore
리턴 void

WorkspaceModel() 보호된 메소드

protected WorkspaceModel ( IEnumerable nodes, IEnumerable notes, IEnumerable annotations, WorkspaceInfo info, NodeFactory factory, IEnumerable presets, ElementResolver resolver ) : Dynamo.Core
nodes IEnumerable
notes IEnumerable
annotations IEnumerable
info WorkspaceInfo
factory NodeFactory
presets IEnumerable
resolver ElementResolver
리턴 Dynamo.Core

프로퍼티 상세

NodeFactory 공개적으로 프로퍼티

A NodeFactory used by this workspace to create Nodes.
public NodeFactory NodeFactory
리턴 NodeFactory

guid 보호되어 있는 프로퍼티

protected Guid guid
리턴 Guid