-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
104 changed files
with
94,809 additions
and
6,995 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
using System; | ||
using System.Text.RegularExpressions; | ||
using System.Xml.Serialization; | ||
using StruSoft.Interop.StruXml.Data; | ||
|
||
namespace FemDesign.Geometry | ||
{ | ||
[Serializable] | ||
public class TextAnnotation: GenericClasses.IStructureElement | ||
{ | ||
[XmlElement("position")] | ||
public Point3d Position { get; set; } | ||
[XmlElement("local_x")] | ||
public Vector3d LocalX { get; set; } | ||
[XmlElement("local_y")] | ||
public Vector3d LocalY { get; set; } | ||
[XmlElement("style")] | ||
public StruSoft.Interop.StruXml.Data.Style_type StyleType { get; set; } | ||
[XmlAttribute("guid")] | ||
public System.Guid Guid { get; set; } | ||
[XmlAttribute("text")] | ||
public string _text; | ||
[XmlIgnore] | ||
public string Text | ||
{ | ||
get | ||
{ | ||
return _text; | ||
} | ||
set | ||
{ | ||
var regex = "[	

 -�]{0,1023}"; | ||
var match = Regex.Match(value, regex); | ||
if (match.Success) | ||
{ | ||
_text = value; | ||
} | ||
else | ||
{ | ||
throw new System.ArgumentException($"text value: {value} has bad formatting. Expected regex pattern: {regex}"); | ||
} | ||
} | ||
} | ||
[XmlIgnore] | ||
public static string DefaultLayer => "0"; | ||
public TextAnnotation() | ||
{ | ||
|
||
} | ||
public void Initialize() | ||
{ | ||
Position = Point3d.Origin; | ||
LocalX = Vector3d.UnitX; | ||
LocalY = Vector3d.UnitY; | ||
StyleType = new Style_type | ||
{ | ||
Layer = DefaultLayer, | ||
Font = new Font_type | ||
{ | ||
Script = Script_type.Default | ||
} | ||
}; | ||
Guid = System.Guid.NewGuid(); | ||
} | ||
|
||
public TextAnnotation(Point3d position, Vector3d localX, Vector3d localY, string text) | ||
{ | ||
this.Initialize(); | ||
Position = position; | ||
LocalX = localX; | ||
LocalY = localY; | ||
Text = text; | ||
} | ||
public TextAnnotation(Point3d position, Vector3d localX, Vector3d localY, Style_type styleType, string text) | ||
{ | ||
this.Initialize(); | ||
Position = position; | ||
LocalX = localX; | ||
LocalY = localY; | ||
StyleType = styleType; | ||
Text = text; | ||
} | ||
|
||
public override string ToString() | ||
{ | ||
return $"TextAnnotation: {this.Text} at {this.Position}"; | ||
} | ||
|
||
public void EntityCreated() | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public void EntityModified() | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public static implicit operator Text_type(TextAnnotation t) => new Text_type{ | ||
Position = t.Position, | ||
Local_x = t.LocalX, | ||
Local_y = t.LocalY, | ||
Style = t.StyleType, | ||
Guid = t.Guid.ToString(), | ||
Text = t.Text, | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.