Pablo Galiano : How do I get the model element associated to a shape and vice versa

Subscriptions

<March 2010>
SuMoTuWeThFrSa
28123456
78910111213
14151617181920
21222324252627
28293031123
45678910

News

Subscribe to Pablo Galiano by Email

Post Categories

How do I get the model element associated to a shape and vice versa

My sixth How do I is up.

Scenario

The scenario here is really simple, we want to get the shape associated with a model element or vice versa. The focus of this How do I tackles this scenario.

 

Interfaces and classes needed

 

Code snippet

Getting the model element corresponding shape:

 

    PresentationViewsSubject.GetPresentation(modelElement)

        .ForEach(pel =>

            {

                ShapeElement shape = pel as ShapeElement;

 

                //TODO: use shape

            });

Getting the model element corresponding shape:

 

    ModelElement modelElement = PresentationViewsSubject.GetSubject(shape);

 

    //TODO: use model element

 

Assemblies needed

  • Microsoft.VisualStudio.Modeling.Sdk.Diagrams

 

Stay tuned,

Pablo

posted on Wednesday, August 20, 2008 11:55 AM by pga

# Extensibility How do I by Pablo #5 and #6 @ Thursday, August 21, 2008 3:02 AM

DSL Related: How do I get the model element associated to a shape and vice versa Interfaces and classes

Anonymous