public CreateCone(System.Xml.XPath.XPathNavigator navigator, GEMSSingle parent) : base(navigator, parent) { alineAxis = (Axis)Enum.Parse(typeof(Axis), navigator.GetAttribute("axis", string.Empty)); //Bottom radius of cylinder navigator.MoveToChild("BottomRadius", string.Empty); bottomRadius = new Length(navigator.GetAttribute("value", string.Empty), navigator.GetAttribute("unit", string.Empty)); navigator.MoveToParent( ); //Top radius of cylinder navigator.MoveToChild("TopRadius", string.Empty); topRadius = new Length(navigator.GetAttribute("value", string.Empty), navigator.GetAttribute("unit", string.Empty)); navigator.MoveToParent( ); //Height of cylinder navigator.MoveToChild("Height", string.Empty); height = new Length(navigator.GetAttribute("value", string.Empty), navigator.GetAttribute("unit", string.Empty)); navigator.MoveToParent( ); //Center of cylinder navigator.MoveToChild("Center", string.Empty); center = new Vector3WithUnit( ); center.X = new Length(navigator.GetAttribute("x", string.Empty), navigator.GetAttribute("ux", string.Empty)); center.Y = new Length(navigator.GetAttribute("y", string.Empty), navigator.GetAttribute("uy", string.Empty)); center.Z = new Length(navigator.GetAttribute("z", string.Empty), navigator.GetAttribute("uz", string.Empty)); navigator.MoveToParent( ); }
private void propertyGrid_PropertyValueChanged(object s, PropertyValueChangedEventArgs e) { if (e.ChangedItem.PropertyDescriptor.ComponentType == typeof(Length)) { this.propertyGrid.Refresh(); } if (m_project.CurrentSelectedObject is GeometryOperation) { GEMSSingle changedSingle = ((GeometryOperation)m_project.CurrentSelectedObject).Parent; changedSingle.SingleDataChangedAlarm(GEMSSingle.SingleDataChangedEventArgs.DataChangeType.GeometryChanged); changedSingle.Parent.DataChangedAlarm(GEMSProject.DataChangedEventArgs.DataChangeType.SingleEdited, changedSingle); } if (m_project.CurrentSelectedObject is GEMSSingle) { GEMSSingle changedSingle = ((GEMSSingle)m_project.CurrentSelectedObject); changedSingle.SingleDataChangedAlarm(GEMSSingle.SingleDataChangedEventArgs.DataChangeType.DisplayStyleChanged); //Maybe change the name of the single changedSingle.Parent.DataChangedAlarm(GEMSProject.DataChangedEventArgs.DataChangeType.SingleEdited, changedSingle); } if (m_project.CurrentSelectedObject is GEMSEnvironment) { ((GEMSEnvironment)m_project.CurrentSelectedObject).GridOptionChangedAlarm(); } }
public CreateCuboid(System.Xml.XPath.XPathNavigator navigator, GEMSSingle parent) : base(navigator, parent) { //Width of box navigator.MoveToChild("Width", string.Empty); width = new Length(navigator.GetAttribute("value", string.Empty), navigator.GetAttribute("unit", string.Empty)); navigator.MoveToParent(); //Depth of box navigator.MoveToChild("Depth", string.Empty); depth = new Length(navigator.GetAttribute("value", string.Empty), navigator.GetAttribute("unit", string.Empty)); navigator.MoveToParent(); //Height of box navigator.MoveToChild("Height", string.Empty); height = new Length(navigator.GetAttribute("value", string.Empty), navigator.GetAttribute("unit", string.Empty)); navigator.MoveToParent(); //Reference point of box navigator.MoveToChild("RefPoint", string.Empty); refPoint = new Vector3WithUnit(); refPoint.X = new Length(navigator.GetAttribute("x", string.Empty), navigator.GetAttribute("ux", string.Empty)); refPoint.Y = new Length(navigator.GetAttribute("y", string.Empty), navigator.GetAttribute("uy", string.Empty)); refPoint.Z = new Length(navigator.GetAttribute("z", string.Empty), navigator.GetAttribute("uz", string.Empty)); navigator.MoveToParent(); }
public override GeometryOperation Clone(int newId, GEMSSingle parent) { CreatePoint point = new CreatePoint(newId, parent); point.Position = new Vector3WithUnit(this.position); return(point); }
public MaterialListForm(GEMSSingle single) { InitializeComponent(); this.single = single; currentMaterialList = new List <GEMSMaterial> (single.Parent.Materials); }
public override GeometryOperation Clone(int newId, GEMSSingle parent) { CreateLine line = new CreateLine(newId, parent); line.StartPoint = new Vector3WithUnit(this.startPoint); line.EndPoint = new Vector3WithUnit(this.endPoint); return(line); }
private void propertyGrid_SelectedObjectsChanged(object sender, EventArgs e) { if (lastSelectedObject is GEMSSingle) { //Unscribe the event GEMSSingle single = lastSelectedObject as GEMSSingle; single.GEMSSingle_DataChanged -= new GEMSSingle.GEMSSingle_DataChangedEventHandler(this.OnGEMSSingleDataChanged); } }
public override GeometryOperation Clone(int newId, GEMSSingle parent) { CreateSphere sphere = new CreateSphere(newId, parent); sphere.Radius = new Length(this.radius); sphere.Center = new Vector3WithUnit(this.center); return(sphere); }
public override GeometryOperation Clone(int newId, GEMSSingle parent) { CreateRound circle = new CreateRound(newId, parent); circle.AlineAxis = this.alineAxis; circle.Radius = new Length(this.radius); circle.Center = new Vector3WithUnit(this.center); return(circle); }
public GEMSSingleRender(Direct3d d3d, GEMSSingle source, GEMSProjectRender render) : base(d3d) { if (source != null) { this.source = source; this.source.GEMSSingle_DataChanged += new GEMSSingle.GEMSSingle_DataChangedEventHandler(GEMSSingle_DataChanged); this.parentRender = render; } }
/// <summary> /// Create a new geometry operation object /// base the information in the xml /// </summary> /// <param name="type"></param> /// <returns></returns> public static GeometryOperation Create(XPathNavigator navigator, GEMSSingle parent) { GeometryOperation operation = null; try { //Get the type of the geometry operation GeometryOperation.GeometryOperationType operationType = (GeometryOperation.GeometryOperationType)Enum.Parse(typeof(GeometryOperation.GeometryOperationType), navigator.GetAttribute("name", string.Empty)); //Create the geometry object based type switch (operationType) { case GeometryOperation.GeometryOperationType.CreateCone: operation = new CreateCone(navigator, parent); break; case GeometryOperation.GeometryOperationType.CreateCylinder: operation = new CreateCylinder(navigator, parent); break; case GeometryOperation.GeometryOperationType.CreateCuboid: operation = new CreateCuboid(navigator, parent); break; case GeometryOperation.GeometryOperationType.CreateLine: operation = new CreateLine(navigator, parent); break; case GeometryOperation.GeometryOperationType.CreatePoint: operation = new CreatePoint(navigator, parent); break; case GeometryOperation.GeometryOperationType.CreateRectangle: operation = new CreateRectangle(navigator, parent); break; case GeometryOperation.GeometryOperationType.CreateSphere: operation = new CreateSphere(navigator, parent); break; case GeometryOperation.GeometryOperationType.CreateRound: operation = new CreateRound(navigator, parent); break; default: break; } } catch { return(operation); } return(operation); }
public override GeometryOperation Clone(int newId, GEMSSingle parent) { CreateCylinder cylinder = new CreateCylinder(newId, parent); cylinder.AlineAxis = this.alineAxis; cylinder.Radius = new Length(this.radius); cylinder.Height = new Length(this.height); cylinder.Center = new Vector3WithUnit(this.center); return(cylinder); }
public override GeometryOperation Clone(int newId, GEMSSingle parent) { CreateCuboid box = new CreateCuboid(newId, parent); box.Width = new Length(this.width); box.Height = new Length(this.height); box.Depth = new Length(this.depth); box.RefPoint = new Vector3WithUnit(this.refPoint); return(box); }
public override GeometryOperation Clone(int newId, GEMSSingle parent) { CreateRectangle rectangle = new CreateRectangle(newId, parent); rectangle.AlineAxis = this.alineAxis; rectangle.Width = new Length(this.width); rectangle.Height = new Length(this.height); rectangle.RefPoint = new Vector3WithUnit(this.refPoint); return(rectangle); }
public CreatePoint(System.Xml.XPath.XPathNavigator navigator, GEMSSingle parent) : base(navigator, parent) { //Position of Point navigator.MoveToChild("Position", string.Empty); position = new Vector3WithUnit(); position.X = new Length(navigator.GetAttribute("x", string.Empty), navigator.GetAttribute("ux", string.Empty)); position.Y = new Length(navigator.GetAttribute("y", string.Empty), navigator.GetAttribute("uy", string.Empty)); position.Z = new Length(navigator.GetAttribute("z", string.Empty), navigator.GetAttribute("uz", string.Empty)); navigator.MoveToParent(); }
public override GeometryOperation Clone(int newId, GEMSSingle parent) { CreateCone cone = new CreateCone(newId, parent); cone.AlineAxis = this.alineAxis; cone.BottomRadius = new Length(this.bottomRadius); cone.TopRadius = new Length(this.topRadius); cone.Height = new Length(this.height); cone.Center = new Vector3WithUnit(this.center); return(cone); }
public CreateSphere(System.Xml.XPath.XPathNavigator navigator, GEMSSingle parent) : base(navigator, parent) { //Radius of sphere navigator.MoveToChild("Radius", string.Empty); radius = new Length(navigator.GetAttribute("value", string.Empty), navigator.GetAttribute("unit", string.Empty)); navigator.MoveToParent(); //Center of sphere navigator.MoveToChild("Center", string.Empty); center = new Vector3WithUnit(); center.X = new Length(navigator.GetAttribute("x", string.Empty), navigator.GetAttribute("ux", string.Empty)); center.Y = new Length(navigator.GetAttribute("y", string.Empty), navigator.GetAttribute("uy", string.Empty)); center.Z = new Length(navigator.GetAttribute("z", string.Empty), navigator.GetAttribute("uz", string.Empty)); navigator.MoveToParent(); }
private void UpdateSingleRenders(GEMSProject.DataChangedEventArgs e) { if (e.changedSingle is GEMSSingle) { GEMSSingle changedSingle = e.changedSingle as GEMSSingle; switch (e.changedType) { case GEMSProject.DataChangedEventArgs.DataChangeType.SingleCutted: case GEMSProject.DataChangedEventArgs.DataChangeType.SingleDeleted: { //Delete one single painter GEMSSingleRender targetSingleRender = null; foreach (GEMSSingleRender singleRender in singleRenders) { if (singleRender.Source == changedSingle) { targetSingleRender = singleRender; } } this.singleRenders.Remove(targetSingleRender); targetSingleRender.Dispose( ); } break; case GEMSProject.DataChangedEventArgs.DataChangeType.SinglePasted: case GEMSProject.DataChangedEventArgs.DataChangeType.SingleCreated: //Create one single painter { GEMSSingleRender newSingleRender = new GEMSSingleRender(d3d, changedSingle, this); newSingleRender.Initialize( ); this.singleRenders.Add(newSingleRender); } break; } } //Re-generate bounding box GenerateBoundingBox( ); if (currentMode == SceneMode.Preview) { isFit = true; } }
public CreateRound(System.Xml.XPath.XPathNavigator navigator, GEMSSingle parent) : base(navigator, parent) { alineAxis = (Axis)Enum.Parse(typeof(Axis), navigator.GetAttribute("axis", string.Empty)); //Radius of circle navigator.MoveToChild("Radius", string.Empty); radius = new Length(navigator.GetAttribute("value", string.Empty), navigator.GetAttribute("unit", string.Empty)); navigator.MoveToParent(); //Center of circle navigator.MoveToChild("Center", string.Empty); center = new Vector3WithUnit(); center.X = new Length(navigator.GetAttribute("x", string.Empty), navigator.GetAttribute("ux", string.Empty)); center.Y = new Length(navigator.GetAttribute("y", string.Empty), navigator.GetAttribute("uy", string.Empty)); center.Z = new Length(navigator.GetAttribute("z", string.Empty), navigator.GetAttribute("uz", string.Empty)); navigator.MoveToParent(); }
private void PositionChanged(object sender, EventArgs e) { if (m_project.CurrentSelectedObject != null) { propertyGrid.SelectedObject = m_project.CurrentSelectedObject; if (this.m_project.CurrentSelectedObject is GEMSSingle) { //Subscribe datachanged event of this single GEMSSingle single = this.m_project.CurrentSelectedObject as GEMSSingle; single.GEMSSingle_DataChanged += new GEMSSingle.GEMSSingle_DataChangedEventHandler(OnGEMSSingleDataChanged); } } else { m_project.CurrentSelectedObject = m_project.Environment; } this.lastSelectedObject = propertyGrid.SelectedObject; }
private void RemoveEO() { if (m_project != null) { if (m_project.CurrentSelectedObject is GEMSSingle || m_project.CurrentSelectedObject is GeometryOperation) { GEMSSingle targetSingle = null; if (m_project.CurrentSelectedObject is GEMSSingle) { targetSingle = (GEMSSingle)m_project.CurrentSelectedObject; } else { targetSingle = ((GeometryOperation)m_project.CurrentSelectedObject).Parent; } targetSingle.CurrentEO = null; targetSingle.SingleDataChangedAlarm(GEMSSingle.SingleDataChangedEventArgs.DataChangeType.EOChanged); } } }
private void SetupPointOutput() { if (m_project != null) { if (m_project.CurrentSelectedObject is GEMSSingle || m_project.CurrentSelectedObject is GeometryOperation) { GEMSSingle targetSingle = null; if (m_project.CurrentSelectedObject is GEMSSingle) { targetSingle = (GEMSSingle)m_project.CurrentSelectedObject; } else { targetSingle = ((GeometryOperation)m_project.CurrentSelectedObject).Parent; } if (targetSingle.CreateOperation is CreatePoint) { PointOutput po = null; if (targetSingle.CurrentEO is PointOutput) { po = targetSingle.CurrentEO as PointOutput; } else { po = new PointOutput(targetSingle); } FieldOutputForm form = new FieldOutputForm(po); if (form.ShowDialog() == DialogResult.OK) { targetSingle.CurrentEO = po; targetSingle.SingleDataChangedAlarm(GEMSSingle.SingleDataChangedEventArgs.DataChangeType.EOChanged); } } } } }
private void SetupCurrentOutput() { if (m_project != null) { if (m_project.CurrentSelectedObject is GEMSSingle || m_project.CurrentSelectedObject is GeometryOperation) { GEMSSingle targetSingle = null; if (m_project.CurrentSelectedObject is GEMSSingle) { targetSingle = (GEMSSingle)m_project.CurrentSelectedObject; } else { targetSingle = ((GeometryOperation)m_project.CurrentSelectedObject).Parent; } if (targetSingle.CreateOperation is CreateRectangle || targetSingle.CreateOperation is CreateRound) { CurrentOutput co = null; if (targetSingle.CurrentEO is CurrentOutput) { co = targetSingle.CurrentEO as CurrentOutput; } else { co = new CurrentOutput(targetSingle); } ExcitationOutputForm form = new ExcitationOutputForm(co); if (form.ShowDialog() == DialogResult.OK) { targetSingle.CurrentEO = co; targetSingle.SingleDataChangedAlarm(GEMSSingle.SingleDataChangedEventArgs.DataChangeType.EOChanged); } } } } }
private void SetupVoltageOutput() { if (m_project != null) { if (m_project.CurrentSelectedObject is GEMSSingle || m_project.CurrentSelectedObject is GeometryOperation) { GEMSSingle targetSingle = null; if (m_project.CurrentSelectedObject is GEMSSingle) { targetSingle = (GEMSSingle)m_project.CurrentSelectedObject; } else { targetSingle = ((GeometryOperation)m_project.CurrentSelectedObject).Parent; } if (targetSingle.CreateOperation is CreateLine) { VoltageOutput vo = null; if (targetSingle.CurrentEO is VoltageOutput) { vo = targetSingle.CurrentEO as VoltageOutput; } else { vo = new VoltageOutput(targetSingle); } ExcitationOutputForm form = new ExcitationOutputForm(vo); if (form.ShowDialog() == DialogResult.OK) { targetSingle.CurrentEO = vo; targetSingle.SingleDataChangedAlarm(GEMSSingle.SingleDataChangedEventArgs.DataChangeType.EOChanged); } } } } }
public CreateLine(System.Xml.XPath.XPathNavigator navigator, GEMSSingle parent) : base(navigator, parent) { navigator.MoveToChild("Positions", string.Empty); navigator.MoveToFirstChild(); //Start Point of line startPoint = new Vector3WithUnit(); startPoint.X = new Length(navigator.GetAttribute("x", string.Empty), navigator.GetAttribute("ux", string.Empty)); startPoint.Y = new Length(navigator.GetAttribute("y", string.Empty), navigator.GetAttribute("uy", string.Empty)); startPoint.Z = new Length(navigator.GetAttribute("z", string.Empty), navigator.GetAttribute("uz", string.Empty)); //End Point of line navigator.MoveToNext(); endPoint = new Vector3WithUnit(); endPoint.X = new Length(navigator.GetAttribute("x", string.Empty), navigator.GetAttribute("ux", string.Empty)); endPoint.Y = new Length(navigator.GetAttribute("y", string.Empty), navigator.GetAttribute("uy", string.Empty)); endPoint.Z = new Length(navigator.GetAttribute("z", string.Empty), navigator.GetAttribute("uz", string.Empty)); navigator.MoveToParent(); navigator.MoveToParent(); }
public CreateRectangle(System.Xml.XPath.XPathNavigator navigator, GEMSSingle parent) : base(navigator, parent) { alineAxis = (Axis)Enum.Parse(typeof(Axis), navigator.GetAttribute("axis", string.Empty)); //Width of rectangle navigator.MoveToChild("Width", string.Empty); width = new Length(navigator.GetAttribute("value", string.Empty), navigator.GetAttribute("unit", string.Empty)); navigator.MoveToParent(); //Height of rectangle navigator.MoveToChild("Height", string.Empty); height = new Length(navigator.GetAttribute("value", string.Empty), navigator.GetAttribute("unit", string.Empty)); navigator.MoveToParent(); //Reference point of rectangle navigator.MoveToChild("RefPoint", string.Empty); refPoint = new Vector3WithUnit(); refPoint.X = new Length(navigator.GetAttribute("x", string.Empty), navigator.GetAttribute("ux", string.Empty)); refPoint.Y = new Length(navigator.GetAttribute("y", string.Empty), navigator.GetAttribute("uy", string.Empty)); refPoint.Z = new Length(navigator.GetAttribute("z", string.Empty), navigator.GetAttribute("uz", string.Empty)); navigator.MoveToParent(); }
public CreateSphere(int id, GEMSSingle parent) : base(id, parent) { }
public CreateCylinder(int id, GEMSSingle parent) : base(id, parent) { }
public CreateRound(int id, GEMSSingle parent) : base(id, parent) { }
public CreatePoint(int id, GEMSSingle parent) : base(id, parent) { }