Example #1
0
 public PivotManip(ShapeCircle circle, ISceneView sceneView)
   : base(sceneView)
 {
   if(circle == null)
   {
     throw new NullReferenceException();
   }
   
   m_ShapeCircle = circle;
   this.EnableOffset = true;
   this.EnableRotate = true;
 }
Example #2
0
 public CircleTemplate(string name, string propertiesFilepath)
   : base(name, propertiesFilepath)
 {
   m_RootCircle = new ShapeCircle(this, new Transform(), (ISceneView)null);
   
   Transform radiusVectorTransform = new Transform();
   radiusVectorTransform.Position = new Vector2f(-100.0f, 0.0f);
   new ShapeCircle(m_RootCircle, radiusVectorTransform);
   
   m_ShapeCircleSettingsList = new List<ShapeCircleSettings>();
   m_ShapeCircleSettingsList.Resize(m_RootCircle.AllCircles.Count);
 }
Example #3
0
 public ShapeCircle(ShapeCircle parent, ITransform transform)
 {
   if(parent != null)
   {
     m_SceneView = parent.SceneView;
     parent.AddChild(this);
   }
   
   m_Owner = parent.Owner;
   m_Parent = parent;
   m_Transform = new TransformWrapper(transform, this.SceneView);
   m_Children = new List<ShapeCircle>();
 }
Example #4
0
 public RectTemplate(string name, string propertiesFilepath)
   : base(name, propertiesFilepath)
 {
   m_RootCircle = new ShapeCircle(this, new Transform(), (ISceneView)null);
   
   Transform leftBottomTransform = new Transform();
   leftBottomTransform.Position = new Vector2f(-100.0f, -100.0f);
   new ShapeCircle(m_RootCircle, leftBottomTransform);
   
   Transform rightTopTransform = new Transform();
   rightTopTransform.Position = new Vector2f(100.0f, 100.0f);
   new ShapeCircle(m_RootCircle, rightTopTransform);
   
   m_ShapeCircleSettingsList = new List<ShapeCircleSettings>();
   m_ShapeCircleSettingsList.Resize(m_RootCircle.AllCircles.Count);
 }
Example #5
0
 private static void SaveShapeCircle(DataElement node, ShapeCircle shapeCircle)
 {
   node.CreateAttribute("position", shapeCircle.Position.ToString());
   node.CreateAttribute("radius", shapeCircle.Radius.ToString());
   node.CreateAttribute("angle", shapeCircle.Angle.ToString());
 }
Example #6
0
 private void HandleRootPositionChanged(ShapeCircle sender)
 {
   if(this.PositionChanged != null)
   {
     this.PositionChanged(this);
   }
 }
Example #7
0
 private void OnTemplateChanged()
 {
   Vector2f position = this.Position;
   float angle = this.Angle;
   if(m_RootCircle != null)
   {
     m_RootCircle.PositionChanged -= this.HandleRootPositionChanged;
     m_RootCircle.AngleChanged -= this.HandleRootAngleChanged;
   }
   
   if(this.Template != null)
   {
     ShapeCircle templateRootCircle = this.Template.RootCircle;
     CompositeTransform compositeTransform = new CompositeTransform();
     if(this.EditTemplateMode)
     {
       compositeTransform.InducedTransforms.Add(templateRootCircle.Transform);
     }
     else
     {
       compositeTransform.InducedTransforms.Add(templateRootCircle.Transform);
       compositeTransform.InducedTransforms.Add(new Transform());
     }
     
     m_RootCircle = new ShapeCircle(this, compositeTransform, this.SceneView);
     m_Color = this.Template.Color;
     foreach(ShapeCircle templateChildCircle in templateRootCircle.Children)
     {
       CreateCircleFromTemplate(templateChildCircle, m_RootCircle);
     }
     
     m_SelectionManip = this.Template.GetSelectionManip(this);
     m_Manips = this.Template.GetManips(this);
     if(m_Manips == null)
     {
       m_Manips = new List<SpatialManip>();
     }
     
     this.UserPropertiesFilepath = this.Template.PropertiesFilepath;
   }
   else
   {
     m_RootCircle = new ShapeCircle(this, new Transform(), this.SceneView);
     m_Color = Color.Black;
     m_Manips = new List<SpatialManip>();
   }
   
   if(!this.EditTemplateMode)
   {
     this.Position = position;
     this.Angle = angle;
   }
   
   m_RootCircle.PositionChanged += this.HandleRootPositionChanged;
   m_RootCircle.AngleChanged += this.HandleRootAngleChanged;
   InvalidateView();
 }
Example #8
0
 public void TryResize(ShapeCircle circle, float radius)
 {
   if(this.Template != null)
   {
     this.Template.TryResize(circle, radius);
   }
 }
Example #9
0
 public Shape FindShape(ShapeCircle circle)
 {
   foreach(Shape shape in m_Shapes)
   {
     if(shape.Circles.Contains(circle))
     {
       return shape;
     }
   }
   
   return null;
 }
Example #10
0
 private void EnableFreeform(ShapeCircle rootCircle, bool freeform)
 {
   foreach(ShapeCircle circle in rootCircle.AllCircles)
   {
     circle.Freeform = freeform;
   }
 }
Example #11
0
 public ShapeCircleSettings GetCircleSettings(ShapeCircle shapeCircle)
 {
   Dictionary<ShapeCircle, ShapeCircleSettings> settings = GetCirclesSettingsMap(shapeCircle);
   return settings[shapeCircle];
 }
Example #12
0
 protected Circle GetAngleManipCircle(ShapeCircle shapeCircle)
 {
   return GetAngleManipCircle(shapeCircle.Position, shapeCircle.Angle);
 }
Example #13
0
 protected Circle GetPositionManipCircle(ShapeCircle shapeCircle)
 {
   return GetPositionManipCircle(shapeCircle.Position);
 }
Example #14
0
 private void AccumChildCircles(List<ShapeCircle> accum, ShapeCircle circle)
 {
   foreach(ShapeCircle childCircle in circle.Children)
   {
     accum.Add(childCircle);
   }
   
   foreach(ShapeCircle childCircle in circle.Children)
   {
     AccumChildCircles(accum, childCircle);
   }
 }
Example #15
0
 private void AddChild(ShapeCircle child)
 {
   m_Children.Add(child);
 }
Example #16
0
 protected virtual void ApplyRotation(ShapeCircle shapeCircle, float angle)
 {
   shapeCircle.Angle = angle;
 }
Example #17
0
 protected void RequestAddManip(List<SpatialManip> manips,
   Dictionary<ShapeCircle, ShapeCircleSettings> shapeSettings, Shape shape, ShapeCircle circle)
 {
   ShapeCircleSettings circleSettings = shapeSettings[circle];
   if(shape.EditTemplateMode || circleSettings.EnableOffset || circleSettings.EnableRotate)
   {
     PivotManip manip = new PivotManip(circle, shape.SceneView);
     manips.Add(manip);
     if(!shape.EditTemplateMode)
     {
       manip.EnableOffset = circleSettings.EnableOffset;
       manip.EnableRotate = circleSettings.EnableRotate;
     }
   }
 }
Example #18
0
 public void TryTranslate(ShapeCircle shapeCircle, Vector2f position)
 {
   EnableFreeform(shapeCircle.Owner.RootCircle, true);
   ApplyPosition(shapeCircle, position);
   EnableFreeform(shapeCircle.Owner.RootCircle, false);
   History.Change();
 }
Example #19
0
 public Dictionary<ShapeCircle, ShapeCircleSettings> GetCirclesSettingsMap(ShapeCircle circle)
 {
   Dictionary<ShapeCircle, ShapeCircleSettings> result =
     new Dictionary<ShapeCircle, ShapeCircleSettings>();
   List<ShapeCircle> allCircles = circle.AllCircles;
   IList<ShapeCircleSettings> perCircleSettings = this.PerCircleSettings;
   for(int index = 0; index < perCircleSettings.Count; ++index)
   {
     result.Add(allCircles[index], perCircleSettings[index]);
   }
   
   return result;
 }
Example #20
0
 public void TryResize(ShapeCircle shapeCircle, float radius)
 {
   EnableFreeform(shapeCircle.Owner.RootCircle, true);
   ApplySize(shapeCircle, radius);
   EnableFreeform(shapeCircle.Owner.RootCircle, false);
   History.Change();
 }
Example #21
0
 public void TryTranslate(ShapeCircle circle, Vector2f position)
 {
   if(this.Template != null)
   {
     this.Template.TryTranslate(circle, position);
   }
 }
Example #22
0
 public void TryRotate(ShapeCircle shapeCircle, float angle)
 {
   EnableFreeform(shapeCircle.Owner.RootCircle, true);
   ApplyRotation(shapeCircle, angle);
   EnableFreeform(shapeCircle.Owner.RootCircle, false);
   History.Change();
 }
Example #23
0
 public void TryRotate(ShapeCircle circle, float angle)
 {
   if(this.Template != null)
   {
     this.Template.TryRotate(circle, angle);
   }
 }
Example #24
0
 protected ShapeCircle CloneRootCircle(ShapeTemplate owner, ISceneView sceneView)
 {
   ShapeCircle clone = new ShapeCircle(owner, this.RootCircle.Transform.Clone(), sceneView);
   foreach(ShapeCircle circle in this.RootCircle.Children)
   {
     CloneCircle(circle, clone);
   }
   
   return clone;
 }
Example #25
0
 private void CreateCircleFromTemplate(ShapeCircle templateCircle, ShapeCircle parent)
 {
   ITransform transform = templateCircle.Transform;
   if(!this.EditTemplateMode)
   {
     CompositeTransform compositeTransform = new CompositeTransform();
     compositeTransform.InducedTransforms.Add(templateCircle.Transform);
     compositeTransform.InducedTransforms.Add(new Transform());
     transform = compositeTransform;
   }
   
   ShapeCircle circle = null;
   if(parent != null)
   {
     circle = new ShapeCircle(parent, transform);
   }
   else
   {
     circle = new ShapeCircle(this, transform, this.SceneView);
   }
   
   foreach(ShapeCircle templateChildCircle in templateCircle.Children)
   {
     CreateCircleFromTemplate(templateChildCircle, circle);
   }
 }
Example #26
0
 private void CloneCircle(ShapeCircle circle, ShapeCircle parent)
 {
   new ShapeCircle(parent, circle.Transform.Clone());
 }
Example #27
0
 private void HandleRootAngleChanged(ShapeCircle sender)
 {
   if(this.AngleChanged != null)
   {
     this.AngleChanged(this);
   }
 }
Example #28
0
 protected virtual void ApplyPosition(ShapeCircle shapeCircle, Vector2f position)
 {
   shapeCircle.Position = position;
 }
Example #29
0
 private static void LoadShapeCircle(DataElement node, ShapeCircle shapeCircle)
 {
   shapeCircle.Position = Vector2f.Parse(node.GetAttribValue("position"));
   shapeCircle.Radius = float.Parse(node.GetAttribValue("radius"));
   shapeCircle.Angle = float.Parse(node.GetAttribValue("angle"));
 }
Example #30
0
 protected virtual void ApplySize(ShapeCircle shapeCircle, float radius)
 {
   shapeCircle.Radius = radius;
 }