public GeometryWrapper(DrawingControl owner, BaseRectangleGeometry geometry) { m_DC = owner; m_Geometry = geometry; if (m_Geometry != null) { m_Geometry.Wrapper = this; } }
public Property_ViewModel(BaseRectangleGeometry owner, string sysName, string strGroup) { m_owner = owner; m_strSystemName = sysName; // IsNumeric = false; // m_strGroup = strGroup; }
/// <summary> /// Returns side at geometry1 at which it is adjusted to geometry2. /// </summary> public static eAdjustedSide GetAdjustedSide(BaseRectangleGeometry geometry1, BaseRectangleGeometry geometry2) { if (geometry1 == null || geometry2 == null) { return(eAdjustedSide.eNotAdjusted); } // Point topLeftPnt_01 = geometry1.TopLeft_GlobalPoint; Point botRightPnt_01 = geometry1.BottomRight_GlobalPoint; // Point topLeftPnt_02 = geometry2.TopLeft_GlobalPoint; Point botRightPnt_02 = geometry2.BottomRight_GlobalPoint; // check left if (Utils.FEQ(topLeftPnt_01.X, botRightPnt_02.X) && ((Utils.FGE(botRightPnt_02.Y, topLeftPnt_01.Y) && Utils.FLE(botRightPnt_02.Y, botRightPnt_01.Y)) || (Utils.FGE(topLeftPnt_02.Y, topLeftPnt_01.Y) && Utils.FLE(topLeftPnt_02.Y, botRightPnt_01.Y)) || (Utils.FGE(topLeftPnt_01.Y, topLeftPnt_02.Y) && Utils.FLE(topLeftPnt_01.Y, botRightPnt_02.Y)) || (Utils.FGE(botRightPnt_01.Y, topLeftPnt_02.Y) && Utils.FLE(botRightPnt_01.Y, botRightPnt_02.Y)))) { return(eAdjustedSide.eLeft); } // check right else if (Utils.FEQ(botRightPnt_01.X, topLeftPnt_02.X) && ((Utils.FGE(botRightPnt_02.Y, topLeftPnt_01.Y) && Utils.FLE(botRightPnt_02.Y, botRightPnt_01.Y)) || (Utils.FGE(topLeftPnt_02.Y, topLeftPnt_01.Y) && Utils.FLE(topLeftPnt_02.Y, botRightPnt_01.Y)) || (Utils.FGE(topLeftPnt_01.Y, topLeftPnt_02.Y) && Utils.FLE(topLeftPnt_01.Y, botRightPnt_02.Y)) || (Utils.FGE(botRightPnt_01.Y, topLeftPnt_02.Y) && Utils.FLE(botRightPnt_01.Y, botRightPnt_02.Y)))) { return(eAdjustedSide.eRight); } // check top else if (Utils.FEQ(topLeftPnt_01.Y, botRightPnt_02.Y) && ((Utils.FGE(topLeftPnt_02.X, topLeftPnt_01.X) && Utils.FLE(topLeftPnt_02.X, botRightPnt_01.X)) || (Utils.FGE(botRightPnt_02.X, topLeftPnt_01.X) && Utils.FLE(botRightPnt_02.X, botRightPnt_01.X)) || (Utils.FGE(topLeftPnt_01.X, topLeftPnt_02.X) && Utils.FLE(topLeftPnt_01.X, botRightPnt_02.X)) || (Utils.FGE(botRightPnt_01.X, topLeftPnt_02.X) && Utils.FLE(botRightPnt_01.X, botRightPnt_02.X)))) { return(eAdjustedSide.eTop); } // check bot else if (Utils.FEQ(botRightPnt_01.Y, topLeftPnt_02.Y) && ((Utils.FGE(topLeftPnt_02.X, topLeftPnt_01.X) && Utils.FLE(topLeftPnt_02.X, botRightPnt_01.X)) || (Utils.FGE(botRightPnt_02.X, topLeftPnt_01.X) && Utils.FLE(botRightPnt_02.X, botRightPnt_01.X)) || (Utils.FGE(topLeftPnt_01.X, topLeftPnt_02.X) && Utils.FLE(topLeftPnt_01.X, botRightPnt_02.X)) || (Utils.FGE(botRightPnt_01.X, topLeftPnt_02.X) && Utils.FLE(botRightPnt_01.X, botRightPnt_02.X)))) { return(eAdjustedSide.eTop); } return(eAdjustedSide.eNotAdjusted); }
public GeometryType_Property(BaseRectangleGeometry owner) : base(owner, "GeometryType", "Geometry Type", "Geometry") { m_IsReadOnly = true; // if (owner != null) { try { string strType = owner.GetType().ToString(); // regex and cut only filename string strPattern = @"[^\.]+$"; Regex regex = new Regex(strPattern); Match match = regex.Match(strType); m_strLocalName = match.Value; } catch { } } }
//============================================================================= // Returns max available height for the geometry based on it's position and roof type. public abstract double CalculateMaxHeightForGeometry(BaseRectangleGeometry geom, Vector geometryAdditionalOffsetVector, double areaLength, double areaWidth);
//============================================================================= public override double CalculateMaxHeightForGeometry(BaseRectangleGeometry geom, Vector geometryAdditionalOffsetVector, double areaLength, double areaWidth) { // just return roof height becuase it is flat return(this.Height); }
public Property_ViewModel(BaseRectangleGeometry owner, string sysName, string localName, bool isReadOnly, string strGroup) : this(owner, sysName, localName, strGroup) { m_IsReadOnly = isReadOnly; }
public Property_ViewModel(BaseRectangleGeometry owner, string sysName, string localName, string strGroup) : this(owner, sysName, strGroup) { m_strLocalName = localName; }
public GeometryProperty(BaseRectangleGeometry owner, string strPropSystemName, string strPropLocName, bool isReadOnly, bool bIsNumeric, string strGroup) : base(owner, strPropSystemName, strPropLocName, isReadOnly, strGroup) { IsNumeric = bIsNumeric; }
//============================================================================= public void Draw() { using (DrawingContext thisDC = this.RenderOpen()) { if (m_DC == null) { return; } DrawingSheet currSheet = m_DC.Sheet; if (currSheet == null) { return; } if (currSheet.Document == null) { return; } if (currSheet.Document.ShowAdvancedProperties) { return; } if (currSheet.SelectedGeometryCollection == null) { return; } // draw lines with distance value if only single geometry selected if (currSheet.SelectedGeometryCollection.Count != 1) { return; } BaseRectangleGeometry selectedGeom = currSheet.SelectedGeometryCollection[0]; if (selectedGeom == null) { return; } // Pen _DistanceLinesPen = new Pen(m_DC.SelectedGeometryInfoBrush, m_DistanceLineThickness); FontFamily textFontFamily = new FontFamily("Arial"); Typeface textTypeFace = new Typeface(textFontFamily, FontStyles.Normal, FontWeights.Normal, FontStretches.Normal); // Point TopLeft_ScreenPoint = m_DC.GetLocalPoint(currSheet, selectedGeom.TopLeft_GlobalPoint); Point TopRight_ScreenPoint = m_DC.GetLocalPoint(currSheet, selectedGeom.TopRight_GlobalPoint); Point BottomRight_ScreenPoint = m_DC.GetLocalPoint(currSheet, selectedGeom.BottomRight_GlobalPoint); Point BottomLeft_ScreenPoint = m_DC.GetLocalPoint(currSheet, selectedGeom.BottomLeft_GlobalPoint); Point Center_ScreenPoint = m_DC.GetLocalPoint(currSheet, selectedGeom.Center_GlobalPoint); if (Utils.FGE(TopLeft_ScreenPoint.X, 0.0) && Utils.FGE(TopLeft_ScreenPoint.Y, 0.0) && Utils.FLE(TopLeft_ScreenPoint.X, m_DC.ActualWidth) && Utils.FLE(TopLeft_ScreenPoint.Y, m_DC.ActualHeight)) { // draw horizontal line and text Point LineStart_ScreenPoint = TopLeft_ScreenPoint; LineStart_ScreenPoint.X = 0; Point LineEnd_ScreenPoint = TopLeft_ScreenPoint; thisDC.DrawLine(_DistanceLinesPen, LineStart_ScreenPoint, LineEnd_ScreenPoint); // text, show global distance string strDistanceY = selectedGeom.TopLeft_GlobalPoint.Y.ToString("."); FormattedText formattedText = new FormattedText(strDistanceY, CultureInfo.CurrentCulture, FlowDirection.LeftToRight, textTypeFace, m_rTextSize, m_DC.SelectedGeometryInfoBrush); formattedText.TextAlignment = TextAlignment.Center; Point Text_ScreenPoint = LineStart_ScreenPoint; Text_ScreenPoint.X -= formattedText.Width / 2; Text_ScreenPoint.Y -= formattedText.Height / 2; thisDC.DrawText(formattedText, Text_ScreenPoint); // draw vertical line and text LineStart_ScreenPoint = TopLeft_ScreenPoint; LineStart_ScreenPoint.Y = 0; LineEnd_ScreenPoint = TopLeft_ScreenPoint; thisDC.DrawLine(_DistanceLinesPen, LineStart_ScreenPoint, LineEnd_ScreenPoint); // text, show global distance string strDistanceX = selectedGeom.TopLeft_GlobalPoint.X.ToString("."); formattedText = new FormattedText(strDistanceX, CultureInfo.CurrentCulture, FlowDirection.LeftToRight, textTypeFace, m_rTextSize, m_DC.SelectedGeometryInfoBrush); formattedText.TextAlignment = TextAlignment.Center; Text_ScreenPoint = LineStart_ScreenPoint; Text_ScreenPoint.Y -= formattedText.Height; thisDC.DrawText(formattedText, Text_ScreenPoint); } // Check that displayed rectangle is placed in displayed area. // If camera displays part of the current sheet then dont display geometry which is outside of displayed area. bool isAllSheetDisplayed = currSheet.IsSheetFullyDisplayed; Point displayedArea_TopLeftPoint = new Point(0.0, 0.0); Point displayedArea_BotRightPoint = new Point(0.0, 0.0); if (!isAllSheetDisplayed) { displayedArea_TopLeftPoint = m_DC.GetGlobalPoint(currSheet, new Point(0.0, 0.0)); displayedArea_BotRightPoint = m_DC.GetGlobalPoint(currSheet, new Point(m_DC.ActualWidth, m_DC.ActualHeight)); // if one rectangle is on the left side of other if (Utils.FGE(displayedArea_TopLeftPoint.X, selectedGeom.BottomRight_GlobalPoint.X) || Utils.FGE(selectedGeom.TopLeft_GlobalPoint.X, displayedArea_BotRightPoint.X)) { return; } // if one rectangle is above other if (Utils.FGE(displayedArea_TopLeftPoint.Y, selectedGeom.BottomRight_GlobalPoint.Y) || Utils.FGE(selectedGeom.TopLeft_GlobalPoint.Y, displayedArea_BotRightPoint.Y)) { return; } // Probably selected geometry is partial displayed, so need to clip drawing context. thisDC.PushClip(new RectangleGeometry(new Rect(new Point(0.0, 0.0), new Point(m_DC.ActualWidth, m_DC.ActualHeight)))); } // Dont draw length and depth for SheetElevationGeometry if (selectedGeom is SheetElevationGeometry) { return; } // if this rectangle is selected than draw its size // // LENGTH AT THE BOTTOM // // draw size leaders Point BotLeft_SizeRack_EndScreenPoint = BottomLeft_ScreenPoint; BotLeft_SizeRack_EndScreenPoint.Y += m_rSizeLeaderLength; thisDC.DrawLine(_DistanceLinesPen, BottomLeft_ScreenPoint, BotLeft_SizeRack_EndScreenPoint); // Point BotRight_SizeRack_EndScreenPoint = BottomRight_ScreenPoint; BotRight_SizeRack_EndScreenPoint.Y += m_rSizeLeaderLength; thisDC.DrawLine(_DistanceLinesPen, BottomRight_ScreenPoint, BotRight_SizeRack_EndScreenPoint); // bool bDrawArrowLinesInside = (BotRight_SizeRack_EndScreenPoint.X - BotLeft_SizeRack_EndScreenPoint.X) > 20; Point BotLeft_WidthSizeLine_ScreenPoint = BottomLeft_ScreenPoint; BotLeft_WidthSizeLine_ScreenPoint.Y += 0.75 * m_rSizeLeaderLength; Point BotRight_WidthSizeLine_ScreenPoint = BottomRight_ScreenPoint; BotRight_WidthSizeLine_ScreenPoint.Y += 0.75 * m_rSizeLeaderLength; if (!bDrawArrowLinesInside) { BotLeft_WidthSizeLine_ScreenPoint.X -= 0.5 * m_rSizeLeaderLength; BotRight_WidthSizeLine_ScreenPoint.X += 0.5 * m_rSizeLeaderLength; } // thisDC.DrawLine(_DistanceLinesPen, BotLeft_WidthSizeLine_ScreenPoint, BotRight_WidthSizeLine_ScreenPoint); // arrows Point LeftWidthArrow_ScreenPoint_1, LeftWidthArrow_ScreenPoint_2; Point RightWidthArrow_ScreenPoint_1, RightWidthArrow_ScreenPoint_2; Point LeftWidthArrow_ScreenPoint_3, RightWidthArrow_ScreenPoint_3; if (bDrawArrowLinesInside) { LeftWidthArrow_ScreenPoint_3 = BotLeft_WidthSizeLine_ScreenPoint; // LeftWidthArrow_ScreenPoint_1 = LeftWidthArrow_ScreenPoint_3; LeftWidthArrow_ScreenPoint_1.X += 0.3 * m_rSizeLeaderLength; LeftWidthArrow_ScreenPoint_1.Y -= 0.1 * m_rSizeLeaderLength; // LeftWidthArrow_ScreenPoint_2 = LeftWidthArrow_ScreenPoint_3; LeftWidthArrow_ScreenPoint_2.X += 0.3 * m_rSizeLeaderLength; LeftWidthArrow_ScreenPoint_2.Y += 0.1 * m_rSizeLeaderLength; RightWidthArrow_ScreenPoint_3 = BotRight_WidthSizeLine_ScreenPoint; // RightWidthArrow_ScreenPoint_1 = RightWidthArrow_ScreenPoint_3; RightWidthArrow_ScreenPoint_1.X -= 0.3 * m_rSizeLeaderLength; RightWidthArrow_ScreenPoint_1.Y -= 0.1 * m_rSizeLeaderLength; // RightWidthArrow_ScreenPoint_2 = RightWidthArrow_ScreenPoint_3; RightWidthArrow_ScreenPoint_2.X -= 0.3 * m_rSizeLeaderLength; RightWidthArrow_ScreenPoint_2.Y += 0.1 * m_rSizeLeaderLength; } else { LeftWidthArrow_ScreenPoint_3 = BotLeft_WidthSizeLine_ScreenPoint; LeftWidthArrow_ScreenPoint_3.X = BottomLeft_ScreenPoint.X; // LeftWidthArrow_ScreenPoint_1 = LeftWidthArrow_ScreenPoint_3; LeftWidthArrow_ScreenPoint_1.X -= 0.3 * m_rSizeLeaderLength; LeftWidthArrow_ScreenPoint_1.Y -= 0.1 * m_rSizeLeaderLength; // LeftWidthArrow_ScreenPoint_2 = LeftWidthArrow_ScreenPoint_3; LeftWidthArrow_ScreenPoint_2.X -= 0.3 * m_rSizeLeaderLength; LeftWidthArrow_ScreenPoint_2.Y += 0.1 * m_rSizeLeaderLength; RightWidthArrow_ScreenPoint_3 = BotRight_WidthSizeLine_ScreenPoint; RightWidthArrow_ScreenPoint_3.X = BottomRight_ScreenPoint.X; // RightWidthArrow_ScreenPoint_1 = RightWidthArrow_ScreenPoint_3; RightWidthArrow_ScreenPoint_1.X += 0.3 * m_rSizeLeaderLength; RightWidthArrow_ScreenPoint_1.Y -= 0.1 * m_rSizeLeaderLength; // RightWidthArrow_ScreenPoint_2 = RightWidthArrow_ScreenPoint_3; RightWidthArrow_ScreenPoint_2.X += 0.3 * m_rSizeLeaderLength; RightWidthArrow_ScreenPoint_2.Y += 0.1 * m_rSizeLeaderLength; } thisDC.DrawLine(_DistanceLinesPen, LeftWidthArrow_ScreenPoint_3, LeftWidthArrow_ScreenPoint_1); thisDC.DrawLine(_DistanceLinesPen, LeftWidthArrow_ScreenPoint_3, LeftWidthArrow_ScreenPoint_2); thisDC.DrawLine(_DistanceLinesPen, RightWidthArrow_ScreenPoint_3, RightWidthArrow_ScreenPoint_1); thisDC.DrawLine(_DistanceLinesPen, RightWidthArrow_ScreenPoint_3, RightWidthArrow_ScreenPoint_2); // text FormattedText widthText = new FormattedText(selectedGeom.Length_X.ToString("."), CultureInfo.CurrentCulture, FlowDirection.LeftToRight, textTypeFace, m_rTextSize, m_DC.SelectedGeometryInfoBrush); widthText.TextAlignment = TextAlignment.Center; Point WidthText_ScreenPoint = BotRight_SizeRack_EndScreenPoint; WidthText_ScreenPoint.X -= (BotRight_SizeRack_EndScreenPoint.X - BotLeft_SizeRack_EndScreenPoint.X) / 2; thisDC.DrawText(widthText, WidthText_ScreenPoint); // // WIDTH AT THE RIGHT BORDER // // draw size leaders Point TopRight_SizeRack_ScreenEndPoint = TopRight_ScreenPoint; TopRight_SizeRack_ScreenEndPoint.X += m_rSizeLeaderLength; // Point BottomRight_SizeRack_ScreenEndPoint = BottomRight_ScreenPoint; BottomRight_SizeRack_ScreenEndPoint.X += m_rSizeLeaderLength; // thisDC.DrawLine(_DistanceLinesPen, TopRight_ScreenPoint, TopRight_SizeRack_ScreenEndPoint); thisDC.DrawLine(_DistanceLinesPen, BottomRight_ScreenPoint, BottomRight_SizeRack_ScreenEndPoint); // bDrawArrowLinesInside = (BottomRight_SizeRack_ScreenEndPoint.Y - TopRight_SizeRack_ScreenEndPoint.Y) > 20; // Point TopHeightLine_ScreenPoint = m_DC.GetLocalPoint(currSheet, selectedGeom.TopRight_GlobalPoint); TopHeightLine_ScreenPoint.X += 0.75 * m_rSizeLeaderLength; Point BottomHeightLine_ScreenPoint = m_DC.GetLocalPoint(currSheet, selectedGeom.BottomRight_GlobalPoint); BottomHeightLine_ScreenPoint.X += 0.75 * m_rSizeLeaderLength; // if (!bDrawArrowLinesInside) { TopHeightLine_ScreenPoint.Y -= 0.5 * m_rSizeLeaderLength; BottomHeightLine_ScreenPoint.Y += 0.5 * m_rSizeLeaderLength; } // thisDC.DrawLine(_DistanceLinesPen, TopHeightLine_ScreenPoint, BottomHeightLine_ScreenPoint); // arrows Point TopHeightArrow_ScreenPoint_1, TopHeightArrow_ScreenPoint_3; Point BotHeightArrow_ScreenPoint_1, BotHeightArrow_ScreenPoint_3; Point TopHeightArrow_ScreenPoint_2, BotHeightArrow_ScreenPoint_2; if (bDrawArrowLinesInside) { TopHeightArrow_ScreenPoint_2 = TopHeightLine_ScreenPoint; // TopHeightArrow_ScreenPoint_1 = TopHeightArrow_ScreenPoint_2; TopHeightArrow_ScreenPoint_1.X -= 0.1 * m_rSizeLeaderLength; TopHeightArrow_ScreenPoint_1.Y += 0.3 * m_rSizeLeaderLength; // TopHeightArrow_ScreenPoint_3 = TopHeightArrow_ScreenPoint_2; TopHeightArrow_ScreenPoint_3.X += 0.1 * m_rSizeLeaderLength; TopHeightArrow_ScreenPoint_3.Y += 0.3 * m_rSizeLeaderLength; BotHeightArrow_ScreenPoint_2 = BottomHeightLine_ScreenPoint; // BotHeightArrow_ScreenPoint_1 = BotHeightArrow_ScreenPoint_2; BotHeightArrow_ScreenPoint_1.X -= 0.1 * m_rSizeLeaderLength; BotHeightArrow_ScreenPoint_1.Y -= 0.3 * m_rSizeLeaderLength; // BotHeightArrow_ScreenPoint_3 = BotHeightArrow_ScreenPoint_2; BotHeightArrow_ScreenPoint_3.X += 0.1 * m_rSizeLeaderLength; BotHeightArrow_ScreenPoint_3.Y -= 0.3 * m_rSizeLeaderLength; } else { TopHeightArrow_ScreenPoint_2 = TopHeightLine_ScreenPoint; TopHeightArrow_ScreenPoint_2.Y = TopRight_ScreenPoint.Y; // TopHeightArrow_ScreenPoint_1 = TopHeightArrow_ScreenPoint_2; TopHeightArrow_ScreenPoint_1.X -= 0.1 * m_rSizeLeaderLength; TopHeightArrow_ScreenPoint_1.Y -= 0.3 * m_rSizeLeaderLength; // TopHeightArrow_ScreenPoint_3 = TopHeightArrow_ScreenPoint_2; TopHeightArrow_ScreenPoint_3.X += 0.1 * m_rSizeLeaderLength; TopHeightArrow_ScreenPoint_3.Y -= 0.3 * m_rSizeLeaderLength; BotHeightArrow_ScreenPoint_2 = BottomHeightLine_ScreenPoint; BotHeightArrow_ScreenPoint_2.Y = BottomRight_ScreenPoint.Y; // BotHeightArrow_ScreenPoint_1 = BotHeightArrow_ScreenPoint_2; BotHeightArrow_ScreenPoint_1.X -= 0.1 * m_rSizeLeaderLength; BotHeightArrow_ScreenPoint_1.Y += 0.3 * m_rSizeLeaderLength; // BotHeightArrow_ScreenPoint_3 = BotHeightArrow_ScreenPoint_2; BotHeightArrow_ScreenPoint_3.X += 0.1 * m_rSizeLeaderLength; BotHeightArrow_ScreenPoint_3.Y += 0.3 * m_rSizeLeaderLength; } thisDC.DrawLine(_DistanceLinesPen, TopHeightArrow_ScreenPoint_2, TopHeightArrow_ScreenPoint_1); thisDC.DrawLine(_DistanceLinesPen, TopHeightArrow_ScreenPoint_2, TopHeightArrow_ScreenPoint_3); thisDC.DrawLine(_DistanceLinesPen, BotHeightArrow_ScreenPoint_2, BotHeightArrow_ScreenPoint_1); thisDC.DrawLine(_DistanceLinesPen, BotHeightArrow_ScreenPoint_2, BotHeightArrow_ScreenPoint_3); // text FormattedText heightText = new FormattedText(selectedGeom.Length_Y.ToString("."), CultureInfo.CurrentCulture, FlowDirection.LeftToRight, textTypeFace, m_rTextSize, m_DC.SelectedGeometryInfoBrush); heightText.TextAlignment = TextAlignment.Center; Point heightTextPoint = TopRight_SizeRack_ScreenEndPoint; heightTextPoint.Y += (BottomRight_SizeRack_ScreenEndPoint.Y - TopRight_SizeRack_ScreenEndPoint.Y) / 2; heightTextPoint.Y -= heightText.Height / 2; heightTextPoint.X += heightText.Width / 2; thisDC.DrawText(heightText, heightTextPoint); // Pop clip if (!isAllSheetDisplayed) { thisDC.Pop(); } } }