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

Subscriptions

<November 2009>
SuMoTuWeThFrSa
25262728293031
1234567
891011121314
15161718192021
22232425262728
293012345

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