private void A_DrawEraseEvent(ActionEventArgs gs) { WallGeometry wall = this.action.Geometry as WallGeometry; sublineGeometry.Start = wall.Start; sublineGeometry.End = wall.End; sublineGeometry.Update(); this.Tip.SetText(sublineGeometry.TextValue, sublineGeometry.TextPosition, sublineGeometry.TextAngle); }
public void InitGeometry(Vector2 offset) { this.DisposeGeometry(); this.geometry = SurfaceManager.Instance.MakeLevelGeometrySurface(); var geo = new WallGeometry(this.geometry); foreach (var wall in this.Walls) { geo.DrawWall(wall, offset); } geo.DrawFloor(this.Floor, offset); }
/// <summary> /// 绘制完成 /// </summary> public void Complete() { if (wallGeometry.Start != null && wallGeometry.End != null) { WallGeometry wall2 = new WallGeometry(); wall2.Start = wallGeometry.End; wall2.PenColor = wallGeometry.PenColor; wall2.LineWidth = wallGeometry.LineWidth; wall2.Thickness = wallGeometry.Thickness; this.wallGeometry = wall2; if (DrawStartEvent != null) { Geometry.IsActioning = true; DrawStartEvent(new ActionEventArgs(this.Geometry)); } } }
public override void OnEnable() { base.OnEnable(); state = State.Suspended; previousState = State.Suspended; climbingState = ClimbingState.Idle; previousClimbingState = ClimbingState.Idle; lastCollidingClimbingState = ClimbingState.None; clothComponents = GetComponentsInChildren <Cloth>(); ledgeGeometry = LedgeGeometry.Create(); wallGeometry = WallGeometry.Create(); ledgeAnchor = LedgeAnchor.Create(); wallAnchor = WallAnchor.Create(); transition = MemoryIdentifier.Invalid; locomotion = MemoryIdentifier.Invalid; }
public override void OnEnable() { base.OnEnable(); kinematica = GetComponent <Kinematica>(); state = State.Suspended; previousState = State.Suspended; climbingState = ClimbingState.Idle; previousClimbingState = ClimbingState.Idle; lastCollidingClimbingState = ClimbingState.None; clothComponents = GetComponentsInChildren <Cloth>(); ledgeGeometry = LedgeGeometry.Create(); wallGeometry = WallGeometry.Create(); ledgeAnchor = LedgeAnchor.Create(); wallAnchor = WallAnchor.Create(); anchoredTransition = AnchoredTransitionTask.Invalid; }
/// <summary> /// Adds wall data ( Wall, Insulated, Sandwich and Double Wall ) to the ModelBuilderData instance. /// </summary> /// <param name="database"> /// </param> /// <param name="modelBuilderData"> /// </param> /// <param name="elementDictionary"> /// </param> void AddWallData( ImpactDatabase database, ref ModelBuilderData modelBuilderData, ref Dictionary<ElementType.KnownValue, List<Element>> elementDictionary ) { if( null == modelBuilderData ) throw new ArgumentNullException( "data" ); if( null == elementDictionary ) throw new ArgumentNullException( "elementDictionary" ); // No need to continue if the list is empty. if( 0 == elementDictionary.Count ) return; List<Element> tempList = null; List<Element> allList = new List<Element>( 500 ); if( elementDictionary.TryGetValue( ElementType.KnownValue.Wall, out tempList ) ) { allList.AddRange( tempList ); elementDictionary.Remove( ElementType.KnownValue.Wall ); } if( elementDictionary.TryGetValue( ElementType.KnownValue.InsulatedWall, out tempList ) ) { allList.AddRange( tempList ); elementDictionary.Remove( ElementType.KnownValue.InsulatedWall ); } if( elementDictionary.TryGetValue( ElementType.KnownValue.Sandwich, out tempList ) ) { allList.AddRange( tempList ); elementDictionary.Remove( ElementType.KnownValue.Sandwich ); } if( elementDictionary.TryGetValue( ElementType.KnownValue.DoubleWall, out tempList ) ) { allList.AddRange( tempList ); elementDictionary.Remove( ElementType.KnownValue.DoubleWall ); } // No walls in the project, no need to query the database for more information. if( allList.Count == 0 ) return; // var wallMaterialArgs = new ImpactDatabase.ProfacomArgs<ImpWallStyleStd>( _factory, _project, GetWallMaterialQuery( _company, _factory, _project ), // ImpWallStyleStd.ElementType, // ImpWallStyleStd.Name ); // var wallMaterialList = database.Profacom( wallMaterialArgs, column => new // { // ElementType = ( (ElementType)DataConverter.Cast<string>( column[0] ) ).EnumValue, // Name = DataConverter.Cast<string>( column[1] ), // MaterialName = DataConverter.Cast<string>( column[2] ), // } ); var wallMaterialList = database.GetAll( GetWallMaterialQuery( this._factory, this._project ).ToString(), column => new { ElementMark = column[0].Cast<string>().Trim(), MaterialName = column[1].Cast<string>(), } ); #region Endcap Edges // Get all endcap edges for walls. var endcapEdgeList = database.GetAll( GetEndcapEdgeQuery( this._factory, this._project ), column => new { ElementMark = column[0].Cast<string>().Trim(), EndcapEdge = new EndcapEdge { Side = ( (Side)column[1].Cast<string>() ).EnumValue, StartAt = column[2].Cast<double>(), Length = column[3].Cast<double>(), FromSide = ( (Side)column[4].Cast<string>() ).EnumValue, IndentAtStart = column[5].Cast<double>(), IndentAtEnd = column[6].Cast<double>(), } } ); #endregion Endcap Edges #region Openings // Get all opening standards. ImpactDatabase.ProfacomArgs<ImpOpeningStd> openingArgs = new ImpactDatabase.ProfacomArgs<ImpOpeningStd>( this._factory, this._project, GetOpeningStandardQuery( this._factory, this._project ), ImpOpeningStd.Name ); var openingStandardDictionary = database.Profacom( openingArgs, column => new { Name = column[0].Cast<string>(), Width = column[1].Cast<double>(), Height = column[2].Cast<double>(), } ).ToDictionary( openingStd => openingStd.Name ); var openingStandard = new { Name = string.Empty, Width = 0d, Height = 0d }; // Get all the openings in the project. var openingList = database.GetAll( GetOpeningQuery( this._factory, this._project ).ToString(), column => new { ElementMark = column[0].Cast<string>().Trim(), Name = column[1].Cast<string>(), X = column[2].Cast<double>(), Y = column[3].Cast<double>(), } ); var openingGroupList = ( from n in openingList let isFound = openingStandardDictionary.TryGetValue( n.Name, out openingStandard ) where isFound select new { n.ElementMark, Opening = new Opening { X = n.X, Y = n.Y, Width = openingStandard.Width, Height = openingStandard.Height } } ).GroupBy( x => x.ElementMark, x => x.Opening ).ToList(); #endregion Openings List<WallGeometry> wallList = new List<WallGeometry>( allList.Count ); foreach( var element in allList ) { WallGeometry wall = new WallGeometry( element.Geometry ); // Endcap Edges. wall.EndcapEdges = ( from endcap in endcapEdgeList where element.Geometry.ElementMark == endcap.ElementMark select endcap.EndcapEdge ).ToList(); // Windows and Doors. var openingGroup = openingGroupList.Find( group => group.Key == element.Geometry.ElementMark ); if( null != openingGroup ) { wall.Openings = openingGroup.ToList(); } // Find the material for the wall. var wallMaterial = wallMaterialList.Find( item => item.ElementMark == wall.ElementMark ); if( null != wallMaterial ) { wall.MaterialName = wallMaterial.MaterialName; } wallList.Add( wall ); } // Add the walls to the model builder data. modelBuilderData.Walls = wallList; }
/// <summary> /// 解析指定的XML对象 /// </summary> /// <param name="messageXML"></param> private void ParseXML(XmlReader xmlReader) { Geometry2D shape = null; switch (xmlReader.Name) { case "ArcGeometry": shape = new ArcGeometry(); break; case "BeamGeometry": shape = new BeamGeometry(); break; case "CircleGeometry": shape = new CircleGeometry(); break; case "CSectionGeometry": shape = new CSectionGeometry(); break; case "EllipseGeometry": shape = new EllipseGeometry(); break; case "FloorGeometry": shape = new FloorGeometry(); break; case "LineGeometry": shape = new LineGeometry(); break; case "MeasureGeometry": shape = new MeasureGeometry(); break; case "MemberGeometry": shape = new MemberGeometry(); break; case "OSBGeometry": shape = new OSBGeometry(); break; case "PointGeometry": shape = new PointGeometry(); break; case "PolygonGeometry": shape = new PolygonGeometry(); break; case "PolylineGeometry": shape = new PolylineGeometry(); break; case "RectangleGeometry": shape = new RectangleGeometry(); break; case "SteelBeamGeometry": shape = new SteelBeamGeometry(); break; case "TextGeometry": shape = new TextGeometry(); break; case "WallGeometry": shape = new WallGeometry(); break; } if (shape != null) { //将信息写入数据流中 shape.ReadXML(xmlReader); //将图形添加都界面上 this.drawingKernel.AddShape(shape); } }