Пример #1
0
        public FontManager()
        {
            m_FontList = new FRList<FRFont>();
            m_ApplicationDefaultFontID = -1;

            AddDefaultFont();
        }
 public LeaderTextGraphicState(DataFragment fragment)
     : base(fragment)
 {
     m_AttachPoint = new GePoint();
     m_InternalPoints = new FRList<GePoint>();
     m_Text = new RichString(PtApp.ActiveDocument.GetFontManager());
 }
Пример #3
0
        public override void GetDisplayList(DisplayItemList DLList
            , Matrix44 trans)
        {
            Debug.Assert(DLList != null && trans != null);
            if (null == DLList || null == trans) return;

            GePoint Base = new GePoint(0, 0, 0);
            GePoint End = new GePoint(m_Width, 0, 0);
            GePoint Top = new GePoint(m_Width, m_Height / 2, 0);
            GePoint Bottom = new GePoint(m_Width, -m_Height / 2, 0);
            Base.Transform(trans);
            End.Transform(trans);
            Top.Transform(trans);
            Bottom.Transform(trans);

            FRList<GePoint> PointList = new FRList<GePoint>();
            PointList.Add(Base);
            PointList.Add(Top);
            PointList.Add(Bottom);
            PointList.Add(Base);

            DisplayItemBuilder.GenDisplayItemLines(DLList, PointList);
            DisplayItemBuilder.GenDisplayItemPoint(DLList, Base);
            DisplayItemBuilder.GenDisplayItemPoint(DLList, End);
        }
Пример #4
0
        public CommandResolver()
        {
            m_CommandList = new FRList<PtCommand>();

            m_SelectCmd = PtApp.Get().GetCommand("SelectCmd");
            if (m_SelectCmd != null) m_SelectCmd.OnCommand();
        }
Пример #5
0
        public PtView(OpenGLSheet PicBox)
        {
            m_PictureBox = PicBox;

            // Add observers.
            m_ViewObserverList = new FRList<ViewPaintObserver>();
            m_ViewObserverList.Add(new NotesObserver());
            m_ViewObserverList.Add(new SelectionObserver());
            m_ViewObserverList.Add(new PreviewObserver());
            m_TransientObjObserver = new TransientObjectObserver();
            m_ViewObserverList.Add(m_TransientObjObserver);

            // Initialize the transform matrix.
            m_DeviceToWorld = Matrix44.Identity;
            m_DeviceToWorld.SetTranslation(GePoint.kOrigin - new GePoint(10, 10));

            // Hook up the events.
            m_PictureBox.MouseDown += new MouseEventHandler(OnMouseDown);
            m_PictureBox.MouseUp += new MouseEventHandler(OnMouseUp);
            m_PictureBox.MouseMove += new MouseEventHandler(OnMouseMove);
            m_PictureBox.MouseDoubleClick += new MouseEventHandler(OnMouseDoubleClick);
            m_PictureBox.MouseClick += new MouseEventHandler(OnMouseClick);
            m_PictureBox.MouseWheel += new MouseEventHandler(OnMouseWheel);

            m_PictureBox.DrawingRender += new System.Windows.Forms.PaintEventHandler(DrawingRender);
            m_PictureBox.DeviceType = OpenGLSheet.GraphicDeviceType.OPENGL;

            m_SelectionManager = new SelectionManager();
        }
Пример #6
0
        private String m_InternalName; // The access key of this group

        #endregion Fields

        #region Constructors

        public CommandGroup(String InternalName, String DisplayName
            , CommandManger CommandManager)
        {
            m_InternalName = InternalName.Clone() as String;
            m_DisplayName = DisplayName.Clone() as String;
            m_Commands = new FRList<String>();
            m_CommandManager = CommandManager;
        }
Пример #7
0
        public override void GetDeleteNominates(FRList<Node> deleteNominateList)
        {
            if (GetFragment() == null)
                return;

            GetFragment().GetImmediatePredecessors(this, deleteNominateList);
            GetFragment().GetImmediateSuccessors(this, deleteNominateList);
        }
Пример #8
0
        public PtDocument()
        {
            m_dFloatTolerance = 1e-7;

            m_NodeList = new FRList<GraphicNode>();

            m_Database = new FRDatabase();
        }
Пример #9
0
        private GePoint m_SnappedPoint; // Be set in visitor

        #endregion Fields

        #region Constructors

        protected SnapContext(FRDatabase database)
        {
            m_CandidateProxies = new FRList<SymbolGeometryConstraint>();
            m_SnappedGeoConst = null;
            SnappedPoint = null;

            m_Database = database;
        }
Пример #10
0
        public FRDatabase()
        {
            m_FontManager = new FontManager();

            m_DataScheme = new PtDataScheme();

            m_InstanceList = new FRList<SymbolConstraint>();

            m_Fragment = new DataFragment();
        }
        public override void DrawMesh(FRList<int> connectivity
            , FRList<GePoint> points, FRList<UnitVector> normals
            , FRList<Color> colors)
        {
            if (m_GraphicContext == null) return;
            ColorAttribute colAtt = new ColorAttribute(m_GraphicContext.m_DrawingColor);
            colAtt.Apply(m_Device);

               base.DrawMesh(connectivity, points, normals, colors);

               colAtt.UnApply(m_Device);
        }
Пример #12
0
        public void GetImmediatePredecessors(Node node, FRList<Node> immediatePres)
        {
            if (immediatePres == null)
                return;

            if (!IsExist(node))
                return;

            UpdateNodeGraph();

            m_Graph.GetImmediatePredecessors(node, immediatePres);
        }
Пример #13
0
        public PtxToolBar()
        {
            m_ToolBar = new ToolBar();
            m_ToolBar.ButtonClick += new ToolBarButtonClickEventHandler(
               this.OnToolBarClick);

            m_ButtonList = new FRList<PtxToolButton>();

            m_ToolBar.TextAlign = ToolBarTextAlign.Right;
            m_ToolBar.AutoSize = false;
            m_ToolBar.Height = 25;
            m_ToolBar.ButtonSize = new System.Drawing.Size(30, 20);
        }
Пример #14
0
        public virtual void DrawMesh(FRList<int> connectivity
            , FRList<GePoint> points, FRList<UnitVector> normals
            , FRList<Color> colors)
        {
            // We should keep the sequence of the points.
            FRList<GePoint> worldPoints = new FRList<GePoint>();
            foreach (GePoint point in points)
            {
                worldPoints.Add(GetDevicePoint(point));
            }

            m_Device.DrawMesh(connectivity, worldPoints
                , normals, colors);
        }
Пример #15
0
        public static void GenDisplayItemLines(DisplayItemList DLList, FRList<GePoint> points)
        {
            Debug.Assert(DLList != null && points != null);
            if (null == DLList || null == points) return;

            if (points.Count < 2) return;

            for (int i = 0; i < points.Count - 1; i++)
            {
                GePoint sp = points[i];
                GePoint ep = points[i + 1];

                GenDisplayItemLine(DLList, sp, ep);
            }
        }
Пример #16
0
        public DimensionParser()
        {
            m_UnitStringList = new FRList<string>();
            for (int i = 0; i < (int)DimensionUnit.eUnitCount; i++)
                m_UnitStringList.Add("");

            // These strings need globalization/ localization
            m_UnitStringList[(int)DimensionUnit.eMM] = "mm";
            m_UnitStringList[(int)DimensionUnit.eCM] = "cm";
            m_UnitStringList[(int)DimensionUnit.eM] = "m";
            m_UnitStringList[(int)DimensionUnit.eInch] = "in";
            // End

            m_Period = '.';
            m_Unit = DimensionUnit.eMM;
        }
Пример #17
0
        // The old oldPoints can't be null, the trans can be null.
        public static FRList<GePoint> GetTransformedPoints(FRList<GePoint> oldPoints, Matrix44 trans)
        {
            Debug.Assert(oldPoints != null);
            FRList<GePoint> newPoints = null;
            if (oldPoints != null && trans != null)
            {
                newPoints = new FRList<GePoint>();
                for (int i = 0; i < oldPoints.Count; i++)
                {
                    newPoints.Add(trans * oldPoints[i]);
                }
            }
            else // either of them is null.
                newPoints = oldPoints;

            return newPoints;
        }
Пример #18
0
        // Normally if all its successors are deleted, it is deletable.
        // Regarding SymbolConstraint, it returns false.
        // Regarding SymbolGraphicState, it is deletable if all its predecessors are deleted.
        public virtual bool IsDeletable(FRList<Node> deletedNodeList)
        {
            if (deletedNodeList == null)
                return false;

            if (GetFragment() == null)
                return true;

            FRList<Node> immediateSuccessors = new FRList<Node>();
            GetFragment().GetImmediateSuccessors(this, immediateSuccessors);
            foreach (Node item in immediateSuccessors)
            {
                if (!deletedNodeList.Contains(item))
                    return false; // Some one isn't deleted, I can't be deleted.
            }

            return true;
        }
Пример #19
0
        public override void GetDisplayList(DisplayItemList DLList
            , Matrix44 trans)
        {
            Debug.Assert(DLList != null && trans != null);
            if (null == DLList || null == trans) return;

            GePoint Base = new GePoint(0, 0, 0);
            GePoint End = new GePoint(m_Width, 0, 0);
            GePoint Top = new GePoint(m_Width, m_Height / 2, 0);
            GePoint Bottom = new GePoint(m_Width, -m_Height / 2, 0);
            Base.Transform(trans);
            End.Transform(trans);
            Top.Transform(trans);
            Bottom.Transform(trans);

            FRList<GePoint> PointList = new FRList<GePoint>();
            PointList.Add(Base);
            PointList.Add(Top);
            PointList.Add(Bottom);
            PointList.Add(Base);

            FRList<GePoint> meshPoints = new FRList<GePoint>();
            meshPoints.Add(Base);
            meshPoints.Add(End);
            meshPoints.Add(Top);
            meshPoints.Add(Bottom);

            // Use two triangles
            FRList<int> connectivity = new FRList<int>();
            connectivity.Add(0);
            connectivity.Add(1);
            connectivity.Add(2);

            connectivity.Add(0);
            connectivity.Add(1);
            connectivity.Add(3);

            DisplayItemBuilder.GenDisplayItemLines(DLList, PointList);
            DisplayItemBuilder.GenDisplayItemMesh(DLList
                , connectivity, meshPoints, null, null);
            DisplayItemBuilder.GenDisplayItemPoint(DLList, Base);
            DisplayItemBuilder.GenDisplayItemPoint(DLList, End);
        }
        protected override bool OnExecute()
        {
            if (m_DraggedCircle == null)
                return false;
            if (m_DraggedCircle.GetFragment() == null)
                return false;

            PointState oldPoint = m_DraggedCircle.GetCenterPoint();
            oldPoint.Point = m_NewPosition;

            // Get the predecessors of the old point state.
            FRList<Node> predecessors = new FRList<Node>();
            m_DraggedCircle.GetFragment().GetImmediatePredecessors(
            oldPoint, predecessors);

            // It is attached to other symbol if the predecessors aren't empty.
            bool IsAttachedToOtherSymbol = (predecessors.Count != 0);
            // Delete the old constraint from fragment.
            if (IsAttachedToOtherSymbol) // The dragged symbol is already attached to a symbol.
            {
                Debug.Assert(predecessors.Count == 1);
                foreach(Node item in predecessors)
                {
                    item.GetFragment().RemoveNode(item, true);
                }
            }

            // Add new constraint
            if (m_SymbolToAttach != null)
            {
                new SymbolPointConstraint(m_DraggedCircle.GetFragment(),
                    m_SymbolToAttach, m_PointIndex, oldPoint);
            }

            m_DraggedCircle.GetFragment().Compute();

            return true;
        }
Пример #21
0
        public void DrawMesh(FRList<int> connectivity
            , FRList<GePoint> points, FRList<UnitVector> normals
            , FRList<Color> colors)
        {
            Debug.Assert(connectivity != null && points != null);
            if (null == connectivity || null == points) return;

            if (connectivity.Count < 3 || points.Count < 3) return;

            // Use the triangles to draw mesh
            // Top - Bottom Left - Bottom Right
            GL.glBegin(GL.GL_TRIANGLES);						// Drawing Using Triangles
            foreach(int index in connectivity)
            {
                // Color
                if (colors != null && index < colors.Count)
                    GL.glColor4ub(colors[index].R
                        , colors[index].G, colors[index].B
                        , colors[index].A);

                // Normal
                if (normals != null && index < normals.Count)
                    GL.glNormal3d(normals[index].X
                        , normals[index].Y, normals[index].Z);

                // Vertex
                if (index < points.Count)
                    GL.glVertex3d(points[index].X
                        , points[index].Y, points[index].Z);
            }
            GL.glEnd();
        }
Пример #22
0
        private FRList<String> GetCandidateAssemblies()
        {
            FRList<String> ComponentAssembies = new FRList<string>();
            String AppPath = System.Environment.CurrentDirectory;

            String[] filelist = System.IO.Directory.GetFiles(AppPath);
            foreach (String file in filelist)
            {
                // We only get the dll files as the candidate assemblies.
                if (file.EndsWith(".dll"))
                    ComponentAssembies.Add(file);
            }

            return ComponentAssembies;
        }
Пример #23
0
 private FWComponetManager()
 {
     m_ComponentList = new FRList<FWComponent>();
     m_ComponentMgr = null;
 }
Пример #24
0
 public override void GetPredecessor(FRList<Node> nodeList)
 {
     nodeList.Add(m_DepCenterPoint);
     base.GetPredecessor(nodeList);
 }
Пример #25
0
 public SelectionSet(String InternalName)
 {
     m_InternalName = String.Copy(InternalName);
     m_SelectionList = new FRList<Selection>();
 }
Пример #26
0
 public SelectionManager()
 {
     m_SelectionSetList = new FRList<SelectionSet>();
     m_PreViewSet = null;
     m_SelectedSet = null;
 }
Пример #27
0
 public DisplayItemList()
 {
     m_ItemList = new FRList<DisplayItem>();
     m_Transformation = null;
 }
Пример #28
0
 public TransientObjectObserver()
 {
     m_NodeList = new FRList<GraphicNode>();
 }
Пример #29
0
 public override void DrawMesh(FRList<int> connectivity
     , FRList<GePoint> points, FRList<UnitVector> normals
     , FRList<Color> colors)
 {
     Debug.Assert(false, "No IMP");
 }
Пример #30
0
 private void LoadComponents(FRList<String> ComponentAssembies)
 {
     foreach (String assemblyPath in ComponentAssembies)
     {
         FWComponent component = LoadComponent(assemblyPath);
         if (component != null)
             m_ComponentList.Add(component);
     }
 }