private static PointF[] GetCurvePoints(IPointsList points) { PointF[] result = new PointF[points.Count - (points.IsClosed ? 1 : 0)]; for (int n = 0; n < result.Length; n++) { result[n] = points[n]; } return(result); }
private void CreateModuleCollection(IPointsList modulePoints) { modulePoints.OldPointsList = modulePoints.PointsList; modulesList = new List <Module>(); for (int i = 0; i < modulePoints.PointsList.Count; i++) { int moduleId = i + 1; var module = Module.ByPoints(modulePoints.PointsList[i]); module.ModuleId = moduleId; ModulesList.Add(module); if (ModulePoints.PointsList != null && ModulePoints.PointsList[0] != null) { for (int j = 0; j < modulePoints.PointsList[i].Count; j++) { int objectId = j; var moduleObject = PersistenceManager.IoC.GetInstance <IBindableObject>(); moduleObject.RegisterContextData(moduleId, objectId); module.PointObjects.Add(moduleObject); } if (modulePoints.PointsList[0].Count > 2) { var planeObject = PersistenceManager.IoC.GetInstance <IBindableObject>(); planeObject.RegisterContextData(moduleId, modulePoints.PointsList[0].Count); module.PlaneObjects.Add(planeObject); var assemblyOccurrenceObject = PersistenceManager.IoC.GetInstance <IBindableObject>(); assemblyOccurrenceObject.RegisterContextData(moduleId, modulePoints.PointsList[0].Count + 1); assemblyOccurrenceObject.Binder.ContextManager.BindingContextManager = PersistenceManager.ActiveAssemblyDoc.ReferenceKeyManager; module.AssemblyOccurrenceObject = assemblyOccurrenceObject; } else { var assemblyOccurrenceObject = PersistenceManager.IoC.GetInstance <IBindableObject>(); assemblyOccurrenceObject.RegisterContextData(moduleId, modulePoints.PointsList[0].Count); assemblyOccurrenceObject.Binder.ContextManager.BindingContextManager = PersistenceManager.ActiveAssemblyDoc.ReferenceKeyManager; module.AssemblyOccurrenceObject = assemblyOccurrenceObject; } } } }
public Modules(IPointsList modulePoints, IModuleBinder binder) { /* * This class will contain the main program control for creating assemblies, * placing them, bookkeeping, etc. The IoC container should only be used * from this class. Classes below this one in the hierarchy should not know * about the container. * * Modules is a collection of Module. Modules also holds top level objects * like the master layout part for the assembly we are constructing. Each * Module has a collection of ModuleObject. ModuleObject is any * bindable object at the Module level. All objects to be bound get * their own binder, and they are responsible for setting the IObjectBinder's * ContextData and ContextManager. This is a Tuple<int, int>, where Item1 is * the Module ID, and Item2 is the ConstraintId. * * ContextData will be the lexicographical order of operations for the whole * collection of module. Its contents will vary with the number of * input constraints per Module. Because we have to create and keep * track of very disparate types of objecs, this ordering has to be somewhat * by convention: * * Modules...............ContextData = <0,0-N>.....Item1 = 0 for top level objects * Module.............ContextData = <1-M,0-P>...<ModuleId, ObjectId> * ModuleObject....ContetxData = <1-M,0-P>...Same as Module level objects */ _binder = binder; _binder.ContextData.Context = new Tuple <int, int>(0, 0); _binder.ContextManager.BindingContextManager = PersistenceManager.ActiveDocument.ReferenceKeyManager; _modulePoints = modulePoints; //_modulePoints.PropertyChanged += _modulePoints_PropertyChanged; //if (ModulePoints.IsDirty) //{ // CreateModuleCollection(modulePoints); //} CreateModuleCollection(modulePoints); }
private static PointF[] GetCurvePoints(IPointsList points, SizeF offset) { PointF[] result = new PointF[points.Count - (points.IsClosed ? 1 : 0)]; for (int n = 0; n < result.Length; n++) result[n] = points[n] + offset; return result; }