mirror of
https://github.com/dgis/xsddiagram.git
synced 2024-09-11 18:47:19 +03:00
Merge branch 'eidmanna-feature/ChangeXSDImage'
This commit is contained in:
commit
154f9ed144
@ -155,7 +155,8 @@ namespace XSDDiagram.Rendering
|
||||
|
||||
childDiagramElement.Diagram = this;
|
||||
childDiagramElement.TabSchema = childElement;
|
||||
childDiagramElement.Name = childElement.name != null ? childElement.name : "";
|
||||
string type = childDiagramElement.GetTypeAnnotation();
|
||||
childDiagramElement.Name = childElement.name != null ? childElement.name + "::" + type : "";
|
||||
childDiagramElement.NameSpace = nameSpace;
|
||||
childDiagramElement.ItemType = DiagramItemType.element;
|
||||
int occurrence;
|
||||
@ -239,6 +240,7 @@ namespace XSDDiagram.Rendering
|
||||
DiagramItem childDiagramElement = new DiagramItem();
|
||||
childDiagramElement.Diagram = this;
|
||||
childDiagramElement.TabSchema = childElement;
|
||||
|
||||
childDiagramElement.Name = childElement.name != null ? childElement.name : "";
|
||||
childDiagramElement.NameSpace = nameSpace;
|
||||
childDiagramElement.ItemType = DiagramItemType.type;
|
||||
|
@ -492,7 +492,8 @@ namespace XSDDiagram.Rendering
|
||||
stringFormatText.Alignment = StringAlignment.Center;
|
||||
stringFormatText.LineAlignment = StringAlignment.Center;
|
||||
stringFormatText.FormatFlags |= StringFormatFlags.NoClip; //MONOFIX
|
||||
_graphics.DrawString(drawingItem.Name, drawingItem.FontScaled, foreground, new RectangleF(scaledElementBox.X, scaledElementBox.Y, scaledElementBox.Width, scaledElementBox.Height), stringFormatText);
|
||||
|
||||
_graphics.DrawString(drawingItem.Name,drawingItem.FontScaled, foreground, new RectangleF(scaledElementBox.X, scaledElementBox.Y, scaledElementBox.Width, scaledElementBox.Height), stringFormatText);
|
||||
}
|
||||
|
||||
// Draw Documentation
|
||||
@ -521,7 +522,7 @@ namespace XSDDiagram.Rendering
|
||||
}
|
||||
|
||||
// Draw occurences small text
|
||||
if (drawingItem.MaxOccurrence > 1 || drawingItem.MaxOccurrence == -1)
|
||||
// if (drawingItem.MaxOccurrence > 1 || drawingItem.MaxOccurrence == -1)
|
||||
{
|
||||
StringFormat stringFormatOccurences = new StringFormat();
|
||||
stringFormatOccurences.Alignment = StringAlignment.Far;
|
||||
@ -530,8 +531,8 @@ namespace XSDDiagram.Rendering
|
||||
//string occurences = string.Format("{0}..", drawingItem.MinOccurrence) + (drawingItem.MaxOccurrence == -1 ? "\u0066∞" : string.Format("{0}", drawingItem.MaxOccurrence));
|
||||
string occurences = string.Format("{0}..", drawingItem.MinOccurrence) + (drawingItem.MaxOccurrence == -1 ? "\u221E" : string.Format("{0}", drawingItem.MaxOccurrence));
|
||||
PointF pointOccurences = new PointF();
|
||||
pointOccurences.X = drawingItem.Diagram.Scale * (drawingItem.Location.X + drawingItem.Size.Width - 10);
|
||||
pointOccurences.Y = drawingItem.Diagram.Scale * (drawingItem.Location.Y + drawingItem.Size.Height + 10);
|
||||
pointOccurences.X = drawingItem.Diagram.Scale * (drawingItem.Location.X + drawingItem.Size.Width + 20);
|
||||
pointOccurences.Y = drawingItem.Diagram.Scale * (drawingItem.Location.Y + drawingItem.Size.Height - 17 );
|
||||
_graphics.DrawString(occurences, drawingItem.SmallFontScaled, foreground, pointOccurences, stringFormatOccurences);
|
||||
}
|
||||
|
||||
|
@ -76,9 +76,9 @@ namespace XSDDiagram.Rendering
|
||||
_childExpandButtonBox = Rectangle.Empty;
|
||||
_boundingBox = Rectangle.Empty;
|
||||
_documentationMinWidth = 100;
|
||||
_size = new Size(50, 25);
|
||||
_size = new Size(100, 25);
|
||||
_margin = new Size(10, 5);
|
||||
_padding = new Size(10, 15);
|
||||
_padding = new Size(10, 2);
|
||||
_itemType = DiagramItemType.element;
|
||||
_childElements = new List<DiagramItem>();
|
||||
}
|
||||
@ -488,6 +488,24 @@ namespace XSDDiagram.Rendering
|
||||
return _diagram.ScaleRectangle(rectangle);
|
||||
}
|
||||
|
||||
public String GetTypeAnnotation()
|
||||
{
|
||||
string text = null;
|
||||
XMLSchema.element element = this.TabSchema as XMLSchema.element;
|
||||
|
||||
if (element != null)
|
||||
{
|
||||
String t = "" + element.type;
|
||||
int idx = t.LastIndexOf(':');
|
||||
|
||||
return t.Substring(idx + 1);
|
||||
|
||||
|
||||
}
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
public string GetTextDocumentation()
|
||||
{
|
||||
string text = null;
|
||||
|
@ -507,13 +507,13 @@ namespace XSDDiagram.Rendering
|
||||
}
|
||||
|
||||
// Draw occurences small text
|
||||
if (drawingItem.MaxOccurrence > 1 || drawingItem.MaxOccurrence == -1)
|
||||
// if (drawingItem.MaxOccurrence > 1 || drawingItem.MaxOccurrence == -1)
|
||||
{
|
||||
string occurences = String.Format("{0}..", drawingItem.MinOccurrence) +
|
||||
(drawingItem.MaxOccurrence == -1 ? "∞" : string.Format("{0}", drawingItem.MaxOccurrence));
|
||||
PointF pointOccurences = new PointF();
|
||||
pointOccurences.X = drawingItem.Diagram.Scale * (drawingItem.Location.X + drawingItem.Size.Width - 10);
|
||||
pointOccurences.Y = drawingItem.Diagram.Scale * (drawingItem.Location.Y + drawingItem.Size.Height + 10);
|
||||
pointOccurences.X = drawingItem.Diagram.Scale * (drawingItem.Location.X + drawingItem.Size.Width + 20);
|
||||
pointOccurences.Y = drawingItem.Diagram.Scale * (drawingItem.Location.Y + drawingItem.Size.Height - 17);
|
||||
string style = String.Format(
|
||||
"font-family:{0};font-size:{1}pt;fill:{2};text-anchor:end;dominant-baseline:central",
|
||||
drawingItem.SmallFont.Name, drawingItem.SmallFont.Size * fontScale, foregroundColor);
|
||||
|
Loading…
Reference in New Issue
Block a user