Пример #1
0
		protected override void DrawEndCap(IGraphics g, bool onScreen, Style style)
		{
			linePen.Color = style.RelationshipColor;
			linePen.Width = style.RelationshipWidth;

			g.FillPath(Brushes.White, Arrowhead.ClosedArrowPath);
			g.DrawPath(linePen, Arrowhead.ClosedArrowPath);
		}
Пример #2
0
        public override void Draw(IGraphics g, bool onScreen, Style style)
        {
            base.Draw(g, onScreen, style);

            if(generalization.Second is ClassType)
                DrawRole(g, style, ((ClassType)generalization.Second).InheritanceStrategy.ToString(), 
                    RouteCache[0], RouteCache[1], StartCapSize);
        }
Пример #3
0
		protected override void DrawStartCap(IGraphics g, bool onScreen, Style style)
		{
			linePen.Color = style.RelationshipColor;
			linePen.Width = style.RelationshipWidth;

			g.FillEllipse(Brushes.White, -Radius, 0, Diameter, Diameter);
			g.DrawEllipse(linePen, -Radius, 0, Diameter, Diameter);
			g.DrawLine(linePen, 0, Radius - CrossSize / 2, 0, Radius + CrossSize / 2);
			g.DrawLine(linePen, -CrossSize / 2, Radius, CrossSize / 2, Radius);
		}
Пример #4
0
		protected override int GetBorderWidth(Style style)
		{
			switch (_class.Modifier)
			{
				case ClassModifier.Abstract:
					return style.AbstractClassBorderWidth;

				case ClassModifier.Sealed:
					return style.SealedClassBorderWidth;

				case ClassModifier.Static:
					return style.StaticClassBorderWidth;

				case ClassModifier.None:
				default:
					return style.ClassBorderWidth;
			}
		}
Пример #5
0
		protected override bool IsBorderDashed(Style style)
		{
			switch (_class.Modifier)
			{
				case ClassModifier.Abstract:
					return style.IsAbstractClassBorderDashed;

				case ClassModifier.Sealed:
					return style.IsSealedClassBorderDashed;

				case ClassModifier.Static:
					return style.IsStaticClassBorderDashed;

				case ClassModifier.None:
				default:
					return style.IsClassBorderDashed;
			}
		}
Пример #6
0
        private void DrawRole(IGraphics g, Style style, string text, Point firstPoint,
            Point secondPoint, Size capSize)
        {
            float angle = GetAngle(firstPoint, secondPoint);
            Point point = firstPoint;

            if (angle == 0) // Down
            {
                point.X -= capSize.Width / 2 + TextMargin.Width;
                point.Y += style.ShadowOffset.Height + TextMargin.Height;
                stringFormat.Alignment = StringAlignment.Far;
                stringFormat.LineAlignment = StringAlignment.Near;
            }
            else if (angle == 90) // Left
            {
                point.X -= TextMargin.Width;
                point.Y += capSize.Width / 2 + TextMargin.Height;
                stringFormat.Alignment = StringAlignment.Far;
                stringFormat.LineAlignment = StringAlignment.Near;
            }
            else if (angle == 180) // Up
            {
                point.X -= capSize.Width / 2 + TextMargin.Width;
                point.Y -= TextMargin.Height;
                stringFormat.Alignment = StringAlignment.Far;
                stringFormat.LineAlignment = StringAlignment.Far;
            }
            else // Right
            {
                point.X += style.ShadowOffset.Width + TextMargin.Width;
                point.Y += capSize.Width / 2 + TextMargin.Height;
                stringFormat.Alignment = StringAlignment.Near;
                stringFormat.LineAlignment = StringAlignment.Near;
            }

            textBrush.Color = style.RelationshipTextColor;
            g.DrawString(text, style.RelationshipTextFont, textBrush, point, stringFormat);
        }
Пример #7
0
		protected override int GetRoundingSize(Style style)
		{
			return style.ClassRoundingSize;
		}
Пример #8
0
		protected override Font GetNameFont(Style style)
		{
			if (_class.Modifier == ClassModifier.Abstract)
				return style.AbstractNameFont;
			else
				return base.GetNameFont(style);
		}
Пример #9
0
		private RectangleF GetEndRoleArea(Style style)
		{
			int last = RouteCache.Count - 1;
			return GetRoleArea(style, AssociationRelationship.EndRole,
				RouteCache[last], RouteCache[last - 1], EndCapSize);
		}
Пример #10
0
		protected virtual void DrawEndCap(IGraphics g, bool onScreen, Style style)
		{
		}
Пример #11
0
		private void DrawLine(IGraphics g, bool onScreen, Style style)
		{
			if (!IsSelected || !onScreen)
			{
				linePen.Width = style.RelationshipWidth;
				linePen.Color = style.RelationshipColor;
				if (IsDashed)
				{
					dashPattern[0] = style.RelationshipDashSize;
					dashPattern[1] = style.RelationshipDashSize;
					linePen.DashPattern = dashPattern;
				}
				else
				{
					linePen.DashStyle = DashStyle.Solid;
				}

				g.DrawLines(linePen, routeCacheArray);
			}
		}
Пример #12
0
		private RectangleF GetLabelArea(Style style)
		{
			bool horizontal;
			PointF center = GetLineCenter(out horizontal);

			SizeF size = Graphics.MeasureString(Relationship.Label,
				style.RelationshipTextFont, PointF.Empty, stringFormat);

			if (horizontal)
			{
				center.X -= size.Width / 2;
				center.Y -= size.Height + TextMargin.Height;
			}
			else
			{
				center.Y -= size.Height / 2;
				center.X += TextMargin.Width;
			}
			
			return new RectangleF(center.X, center.Y, size.Width, size.Height);
		}
Пример #13
0
		protected override GradientStyle GetGradientHeaderStyle(Style style)
		{
			return style.ClassGradientHeaderStyle;
		}
Пример #14
0
		private static void AddToList(Style style, string stylePath)
		{
			if (!styles.ContainsKey(stylePath))
			{
				styles.Add(stylePath, style);
			}
			else // Replace the old style
			{
				styles.Remove(stylePath);
				styles.Add(stylePath, style);
			}
		}
Пример #15
0
		private static bool LoadCurrentStyle()
		{
			return ((currentStyle = Load(userStylePath, false)) != null);
		}
Пример #16
0
		static Style()
		{
			Directory.CreateDirectory(StylesDirectory);
			LoadStyles();
			if (!LoadCurrentStyle())
			{
				CurrentStyle = new Style();
				SaveCurrentStyle();
			}
		}
Пример #17
0
		private RectangleF MultiplicityArea(Style style, string text, Point firstPoint,
			Point secondPoint, Size capSize)
		{
			float angle = GetAngle(firstPoint, secondPoint);

			SizeF textSize = Graphics.MeasureString(text, style.RelationshipTextFont,
				PointF.Empty, stringFormat);
			RectangleF area = new RectangleF(firstPoint, textSize);

			if (angle == 0) // Down
			{
				area.X += capSize.Width / 2 + TextMargin.Width;
				area.Y += style.ShadowOffset.Height + TextMargin.Height;
			}
			else if (angle == 90) // Left
			{
				area.X -= textSize.Width + TextMargin.Width;
				area.Y -= textSize.Height + capSize.Width / 2 + TextMargin.Height;
			}
			else if (angle == 180) // Up
			{
				area.X += capSize.Width / 2 + TextMargin.Width;
				area.Y -= textSize.Height + TextMargin.Height;
			}
			else // Right
			{
				area.X += style.ShadowOffset.Width + TextMargin.Width;
				area.Y -= textSize.Height + capSize.Width / 2 + TextMargin.Height;
			}

			return area;
		}
Пример #18
0
		private RectangleF GetEndMultiplicityArea(Style style)
		{
			int last = RouteCache.Count - 1;
			return MultiplicityArea(style, AssociationRelationship.EndMultiplicity,
				RouteCache[last], RouteCache[last - 1], EndCapSize);
		}
Пример #19
0
		private RectangleF GetStartMultiplicityArea(Style style)
		{
			return MultiplicityArea(style, AssociationRelationship.StartMultiplicity,
				RouteCache[0], RouteCache[1], StartCapSize);
		}
Пример #20
0
		protected override RectangleF CalculateDrawingArea(Style style, bool printing, float zoom)
		{
			RectangleF area = base.CalculateDrawingArea(style, printing, zoom);

			if (AssociationRelationship.StartRole != null)
				area = RectangleF.Union(area, GetStartRoleArea(style));

			if (AssociationRelationship.EndRole != null)
				area = RectangleF.Union(area, GetEndRoleArea(style));

			if (AssociationRelationship.StartMultiplicity != null)
				area = RectangleF.Union(area, GetStartMultiplicityArea(style));

			if (AssociationRelationship.EndMultiplicity != null)
				area = RectangleF.Union(area, GetEndMultiplicityArea(style));

			return area;
		}
Пример #21
0
		protected override void DrawEndCap(IGraphics g, bool onScreen, Style style)
		{
			if (association.Direction == Direction.Unidirectional)
			{
				linePen.Color = style.RelationshipColor;
				linePen.Width = style.RelationshipWidth;
				g.DrawLines(linePen, Arrowhead.OpenArrowPoints);
			}
		}
Пример #22
0
		protected override Color GetBackgroundColor(Style style)
		{
            return style.ClassBackgroundColor;
		}
Пример #23
0
		protected override RectangleF CalculateDrawingArea(Style style, bool printing, float zoom)
		{
			RectangleF area = GetRouteArea();

			float lineSize = (float) style.RelationshipWidth / 2;
			if (IsSelected && !printing)
				lineSize = Math.Max(lineSize, (float) BendPoint.SquareSize / 2 / zoom);
			area.Inflate(lineSize, lineSize);

			if (StartCapSize != Size.Empty)
				area = RectangleF.Union(area, GetStartCapArea());

			if (EndCapSize != Size.Empty)
				area = RectangleF.Union(area, GetEndCapArea());

			if (Relationship.Label != null)
				area = RectangleF.Union(area, GetLabelArea(style));

			return area;
		}
Пример #24
0
		protected override Color GetBorderColor(Style style)
		{
			return style.ClassBorderColor;
		}
Пример #25
0
		public override void Draw(IGraphics g, bool onScreen, Style style)
		{
			DrawLine(g, onScreen, style);
			DrawCaps(g, onScreen, style);
			if (Relationship.SupportsLabel)
				DrawLabel(g, onScreen, style);
		}
Пример #26
0
		protected override void DrawStartCap(IGraphics g, bool onScreen, Style style)
		{
			linePen.Color = style.RelationshipColor;
			linePen.Width = style.RelationshipWidth;

			if (association.IsAggregation)
			{
				g.FillPolygon(Brushes.White, diamondPoints);
				g.DrawPolygon(linePen, diamondPoints);
			}
			else if (association.IsComposition)
			{
				lineBrush.Color = style.RelationshipColor;

				g.FillPolygon(lineBrush, diamondPoints);
				g.DrawPolygon(linePen, diamondPoints);
			}
		}
Пример #27
0
		private void DrawCaps(IGraphics g, bool onScreen, Style style)
		{
			Matrix transformState = g.Transform;
			g.TranslateTransform(routeCache[0].X, routeCache[0].Y);
			g.RotateTransform(GetAngle(routeCache[0], routeCache[1]));
			DrawStartCap(g, onScreen, style);
			g.Transform = transformState;

			int last = routeCache.Count - 1;
			g.TranslateTransform(routeCache[last].X, routeCache[last].Y);
			g.RotateTransform(GetAngle(routeCache[last], routeCache[last - 1]));
			DrawEndCap(g, onScreen, style);
			g.Transform = transformState;
		}
Пример #28
0
		protected override Color GetHeaderColor(Style style)
		{
            return style.ClassHeaderColor;
		}
Пример #29
0
		private void DrawLabel(IGraphics g, bool onScreen, Style style)
		{
			if (Relationship.Label != null)
			{
				bool horizontal;
				PointF center = GetLineCenter(out horizontal);

				textBrush.Color = style.RelationshipTextColor;
				if (horizontal)
				{
					stringFormat.Alignment = StringAlignment.Center;
					stringFormat.LineAlignment = StringAlignment.Far;
					center.Y -= TextMargin.Height;
				}
				else
				{
					stringFormat.Alignment = StringAlignment.Near;
					stringFormat.LineAlignment = StringAlignment.Center;
					center.X += TextMargin.Width;
				}
				g.DrawString(Relationship.Label, style.RelationshipTextFont,
					textBrush, center, stringFormat);
			}
		}
Пример #30
0
		private RectangleF GetStartRoleArea(Style style)
		{
			return GetRoleArea(style, AssociationRelationship.StartRole,
				RouteCache[0], RouteCache[1], StartCapSize);
		}