private void Ports_InsertElement(object sender, ElementsEventArgs e) { return; //TODO: Descobrir qual evento deve ser ignorado para impossibilitar lin.Start de ser movido! //Sets the shape of the port Port port = (Port)e.Value; port.SetParent(this); port.SetLayer(Layer); port.ElementInvalid += new EventHandler(Port_ElementInvalid); port.SetModel(Model); port.SetOrder(_ports.Count - 1); //If not deserializing then locate port if (port.Location.IsEmpty) { LocatePort(port); } //Else just set orientation and offset else { port.Orientation = GetPortOrientation(port, port.Location); port.SetOffset(port.CalculateOffset()); } }
//Occurs when an element is removed from the elements collection private void Element_Remove(object sender, ElementsEventArgs e) { Element element = e.Value; //Remove handlers element.ElementInvalid -= new EventHandler(Element_ElementInvalid); //Remove the element from default level element.Layer.Elements.SetModifiable(true); element.Layer.Elements.Remove(element.LayerKey); element.Layer.Elements.SetModifiable(false); if (element is Shape) { ResetLines((Shape)element); } //Remove origin handlers if (element is Line) { Line line = (Line)element; line.Start.RemoveHandlers(); line.End.RemoveHandlers(); } //Re-render and redraw CreateRenderList(); Invalidate(); //Raise the ElementRemovedEvent OnElementRemoved(element); }
//Occurs when an element is added to the elements collection private void Element_Remove(object sender, ElementsEventArgs e) { Element element = e.Value; element.ElementInvalid -= new EventHandler(Element_ElementInvalid); CreateRenderList(); OnElementInvalid(); }
//Occurs when an element is removed from the elements collection private void Element_Remove(object sender, ElementsEventArgs e) { if (e.Value is Shape) { ResetLines((Shape)e.Value); } //Remove from the renderlist Elements.Remove(e.Value); //Raise the ElementRemovedEvent OnElementRemoved(e.Value); OnModelInvalid(); }
//Occurs when an element is added to the elements collection private void Element_Insert(object sender, ElementsEventArgs e) { Element element = e.Value; //Set the layer element.SetLayer(Layer); //Set handlers element.ElementInvalid += new EventHandler(Element_ElementInvalid); //Set the container element.SetContainer(Container); CreateRenderList(); OnElementInvalid(); }
//Occurs when an element is added to the elements collection private void Element_Insert(object sender, ElementsEventArgs e) { Element element = e.Value; //Set handlers element.ElementInvalid += new EventHandler(Element_ElementInvalid); //Add to the renderlist Elements.SetModifiable(true); Elements.Add(element); Elements.SetModifiable(false); //Raise the ElementInserted event OnElementInserted(element); OnModelInvalid(); }
private void Ports_InsertElement(object sender, ElementsEventArgs e) { //Sets the shape of the port Port port = (Port)e.Value; port.SetParent(this); port.SetLayer(Layer); port.ElementInvalid += new EventHandler(Port_ElementInvalid); port.SetModel(Model); port.SetOrder(_ports.Count - 1); //Locate if not deserializing if (port.Location.IsEmpty) { LocatePort(port); } }
private void Ports_InsertElement(object sender, ElementsEventArgs e) { //Sets the shape of the port Port port = (Port)e.Value; port.SetParent(this); port.SetLayer(Layer); port.ElementInvalid += new EventHandler(Port_ElementInvalid); port.SetModel(Model); port.SetOrder(_ports.Count - 1); //If not deserializing then locate port if (port.Location.IsEmpty) { LocatePort(port); } //Else just set orientation and offset else { port.Orientation = GetPortOrientation(port, port.Location); port.SetOffset(port.CalculateOffset()); } }
private void Ports_InsertElement(object sender, ElementsEventArgs e) { //Sets the shape of the port Port port = (Port) e.Value; port.SetParent(this); port.SetLayer(Layer); port.ElementInvalid +=new EventHandler(Port_ElementInvalid); port.SetContainer(Container); port.SetOrder(mPorts.Count -1); //If not deserializing then locate port if (port.Location.IsEmpty) { LocatePort(port); } //Else just set orientation and offset else { port.Orientation = GetPortOrientation(port, port.Location); port.SetOffset(port.CalculateOffset()); } }
//Occurs when an element is removed from the elements collection private void Element_Remove(object sender, ElementsEventArgs e) { Element element = e.Value; //Remove handlers element.ElementInvalid -=new EventHandler(Element_ElementInvalid); //Remove the element from default level element.Layer.Elements.SetModifiable(true); element.Layer.Elements.Remove(element.LayerKey); element.Layer.Elements.SetModifiable(false); if (element is Shape) ResetLines((Shape) element); //Remove origin handlers if (element is Line) { Line line = (Line) element; line.Start.RemoveHandlers(); line.End.RemoveHandlers(); } //Re-render and redraw CreateRenderList(); Invalidate(); //Raise the ElementRemovedEvent OnElementRemoved(element); }
//Occurs when an element is added to the elements collection private void Element_Insert(object sender, ElementsEventArgs e) { Element element = e.Value; if (element is Group) throw new GroupException("A group cannot be added to another group."); //Set the layer if not already set //Deserialized elements have layer information set if (element.Layer == null && Layer != null) { Layer layer = Layer; element.SetLayer(layer); //Add to the default level string key = layer.Elements.CreateKey(); layer.Elements.SetModifiable(true); layer.Elements.Add(key, element); layer.Elements.SetModifiable(false); //Set the layer key element.SetLayerKey(key); //Set the element z order element.mZOrder = layer.Elements.Count; if (element is IUserInteractive) { IUserInteractive interactive = (IUserInteractive) element; if ((interactive.Interaction & UserInteraction.BringToFront) == UserInteraction.BringToFront) layer.Elements.BringToFront(element); } } //Set the container element.SetContainer(this); //Set handlers element.ElementInvalid +=new EventHandler(Element_ElementInvalid); //Draw the path if a line if (element is Line) { Line line = (Line) element; //If a connector and is not auto routed then calculate points if (element is Connector) { Connector connector = (Connector) element; if (connector.Points == null) connector.CalculateRoute(); } line.DrawPath(); } //Set any containers for child elements if (element is IPortContainer) { IPortContainer container = (IPortContainer) element; foreach (Port port in container.Ports.Values) { port.SetContainer(this); } } CreateRenderList(); OnElementInvalid(); //Raise the ElementInserted event OnElementInserted(element); }
private void Model_ElementRemoved(object sender, ElementsEventArgs e) { // Check Terrain if (this._terrain == null) { return; } // Get Element Element element = e.Value; if (element == null) { return; } EsriLine<TerrainDataSource> line = element as EsriLine<TerrainDataSource>; if (line == null) { return; } // Get Rule TerrainDataSource terrainDataSource = line.Parent; // DiagrammerEnvironment diagrammerEnvironment = DiagrammerEnvironment.Default; SchemaModel schemaModel = diagrammerEnvironment.SchemaModel; Terrain terrain = schemaModel.FindParent(terrainDataSource); if (terrain != null) { terrain.TerrainDataSources.Remove(terrainDataSource); } }
// // PRIVATE METHODS // private void Model_ElementInserted(object sender, ElementsEventArgs e) { // Check GeometricNetwork if (this._geometricNetwork == null) { return; } // Get Element Element element = e.Value; if (element == null) { return; } EsriLine<EdgeConnectivityRule> line = element as EsriLine<EdgeConnectivityRule>; if (line == null) { return; } // Get Rule EdgeConnectivityRule rule = line.Parent; // Add Rule this._geometricNetwork.ConnectivityRules.Add(rule); }
// // PRIVATE METHODS // private void Model_ElementInserted(object sender, ElementsEventArgs e) { }
//Occurs when an element is added to the elements collection private void Element_Remove(object sender, ElementsEventArgs e) { Element element = e.Value; element.ElementInvalid -=new EventHandler(Element_ElementInvalid); CreateRenderList(); OnElementInvalid(); }
// // PRIVATE METHODS // private void Model_ElementInserted(object sender, ElementsEventArgs e) { // Check Topology if (this._topology == null) { return; } // Get Element Element element = e.Value; if (element == null) { return; } EsriLine<TopologyRule> line = element as EsriLine<TopologyRule>; if (line == null) { return; } // Get Rule TopologyRule rule = line.Parent; // Add Rule this._topology.TopologyRules.Add(rule); }
//Occurs when an element is added to the elements collection private void Element_Insert(object sender, ElementsEventArgs e) { Element element = e.Value; if (element is Group) { throw new GroupException("A group cannot be added to another group."); } //Set the layer if not already set //Deserialized elements have layer information set if (element.Layer == null && Layer != null) { Layer layer = Layer; element.SetLayer(layer); //Add to the default level string key = layer.Elements.CreateKey(); layer.Elements.SetModifiable(true); layer.Elements.Add(key, element); layer.Elements.SetModifiable(false); //Set the layer key element.SetLayerKey(key); //Set the element z order element.mZOrder = layer.Elements.Count; if (element is IUserInteractive) { IUserInteractive interactive = (IUserInteractive)element; if ((interactive.Interaction & UserInteraction.BringToFront) == UserInteraction.BringToFront) { layer.Elements.BringToFront(element); } } } //Set the container element.SetContainer(this); //Set handlers element.ElementInvalid += new EventHandler(Element_ElementInvalid); //Draw the path if a line if (element is Line) { Line line = (Line)element; //If a connector and is not auto routed then calculate points if (element is Connector) { Connector connector = (Connector)element; if (connector.Points == null) { connector.CalculateRoute(); } } line.DrawPath(); } //Set any containers for child elements if (element is IPortContainer) { IPortContainer container = (IPortContainer)element; foreach (Port port in container.Ports.Values) { port.SetContainer(this); } } CreateRenderList(); OnElementInvalid(); //Raise the ElementInserted event OnElementInserted(element); }
private void Ports_InsertElement(object sender, ElementsEventArgs e) { //Sets the shape of the port Port port = (Port) e.Value; port.SetParent(this); port.SetLayer(Layer); port.ElementInvalid +=new EventHandler(Port_ElementInvalid); port.SetContainer(Container); port.SetOrder(mPorts.Count -1); //Locate if not deserializing if (port.Location.IsEmpty) LocatePort(port); }
private void EsriModel_ElementInserted(object sender, ElementsEventArgs e) { if (e == null) { return; } if (e.Value == null) { return; } Element element = e.Value; if (element is Table) { Table table = (Table)element; foreach (TableRow row in table.Rows) { this.ResetTable(row, table); } foreach (TableGroup group in table.Groups) { this.ResetTable(group, table); } } }
private void Model_ElementRemoved(object sender, ElementsEventArgs e) { // Check GeometricNetwork if (this._geometricNetwork == null) { return; } // Get Element Element element = e.Value; if (element == null) { return; } EsriLine<EdgeConnectivityRule> line = element as EsriLine<EdgeConnectivityRule>; if (line == null) { return; } // Get Rule EdgeConnectivityRule rule = line.Parent; // Remove rule from relationship this._geometricNetwork.ConnectivityRules.Remove(rule); }
// // PRIVATE METHODS // private void Model_ElementInserted(object sender, ElementsEventArgs e) { // Check Relationship if (this._relationshipClass == null) { return; } // Get Element Element element = e.Value; if (element == null) { return; } EsriLine<RelationshipRule> line = element as EsriLine<RelationshipRule>; if (line == null) { return; } // Get Rule RelationshipRule rule = line.Parent; // Add Rule this._relationshipClass.RelationshipRules.Add(rule); }
//Occurs when an element is added to the elements collection private void Element_Insert(object sender, ElementsEventArgs e) { Element element = e.Value; //Set the layer if not already set //Deserialized elements have layer information set if (element.Layer == null) { Layer layer = Layers.CurrentLayer; element.SetLayer(layer); //Add to the default level string key = layer.Elements.CreateKey(); layer.Elements.SetModifiable(true); layer.Elements.Add(key, element); layer.Elements.SetModifiable(false); //Set the layer key element.SetLayerKey(key); //Set the element z order element.mZOrder = layer.Elements.Count; if (element is IUserInteractive) { IUserInteractive interactive = (IUserInteractive) element; if ((interactive.Interaction & UserInteraction.BringToFront) == UserInteraction.BringToFront) layer.Elements.BringToFront(element); } } //Set the container element.SetContainer(this); //Set handlers element.ElementInvalid +=new EventHandler(Element_ElementInvalid); //Draw the path if a line if (element is Line) { Line line = (Line) element; //If a connector and is not auto routed and is not being deserialized then calculate points if (element is Connector) { Connector connector = (Connector) element; if (connector.Points == null) connector.CalculateRoute(); } line.DrawPath(); } //Set up route class if group if (element is Group) { Group group = (Group) element; group.Route = new Route(); group.Route.Container = group; //Set the level for all the shapes in the group foreach (Element child in group.Shapes.Values) { child.SetLayer(Layers.CurrentLayer); } //Set the level for all the lines in the group foreach (Element child in group.Lines.Values) { child.SetLayer(Layers.CurrentLayer); } } //Set any containers for child elements if (element is IPortContainer) { IPortContainer container = (IPortContainer) element; foreach (Port port in container.Ports.Values) { port.SetContainer(this); port.SetLayer(element.Layer); if (port.Location.IsEmpty) container.LocatePort(port); } } //Set container and layers for children of compelx shape if (element is ComplexShape) { ComplexShape complex = (ComplexShape) element; foreach (Element child in complex.Children.Values) { child.SetContainer(this); child.SetLayer(Layers.CurrentLayer); } } //Set the height of the table if (element is Table) { Table table = (Table) element; table.SetHeight(); } //Flag the routing terrain to be reformed if (Route != null) Route.Reform(); //Re-render and redraw if (!Suspended) GetRenderList(Render.RenderRectangle); Invalidate(); //Raise the ElementInserted event OnElementInserted(element); }
private void Model_ElementRemoved(object sender, ElementsEventArgs e) { // Check Topology if (this._topology == null) { return; } // Get Element Element element = e.Value; if (element == null) { return; } EsriLine<TopologyRule> line = element as EsriLine<TopologyRule>; if (line == null) { return; } // Get Rule TopologyRule rule = line.Parent; // Remove rule from relationship this._topology.TopologyRules.Remove(rule); }
//Occurs when an element is removed from the elements collection private void Element_Remove(object sender, ElementsEventArgs e) { Element element = e.Value; //Remove handlers element.ElementInvalid -=new EventHandler(Element_ElementInvalid); //Remove the element from the level it is in element.Layer.Elements.SetModifiable(true); element.Layer.Elements.Remove(element.LayerKey); element.Layer.Elements.SetModifiable(false); if (element is Shape) ResetLines((Shape) element); //Remove origin handlers if (element is Line) { Line line = (Line) element; line.Start.RemoveHandlers(); line.End.RemoveHandlers(); } //Flag the routing terrain to be reformed if (Route != null) Route.Reform(); //Re-render and redraw if (!Suspended) GetRenderList(Render.RenderRectangle); Invalidate(); //Raise the ElementRemovedEvent OnElementRemoved(element); }
private void Model_ElementRemoved(object sender, ElementsEventArgs e) { // Check Relationship if (this._geometricNetwork == null) { return; } // Get Element Element element = e.Value; if (element == null) { return; } EsriLine<GeometricNetworkControllerMembership> line = element as EsriLine<GeometricNetworkControllerMembership>; if (line == null) { return; } // Get Rule GeometricNetworkControllerMembership controller = line.Parent; // DiagrammerEnvironment diagrammerEnvironment = DiagrammerEnvironment.Default; SchemaModel schemaModel = diagrammerEnvironment.SchemaModel; ObjectClass objectClass = schemaModel.FindParent(controller); if (objectClass != null) { objectClass.ControllerMemberships.Remove(controller); } }
//Occurs when an element is added to the elements collection private void Element_Insert(object sender, ElementsEventArgs e) { Element element = e.Value; //Set the layer element.SetLayer(Layer); //Set handlers element.ElementInvalid +=new EventHandler(Element_ElementInvalid); //Set the container element.SetContainer(Container); CreateRenderList(); OnElementInvalid(); }