コード例 #1
0
        //--------------------------------------------------------------------------------------------------

        static void _UpdateAttributesForLayer(Layer layer, ref AttributeSet attributeSet)
        {
            // Normal mode Drawer
            var shadingAspect = new Prs3d_ShadingAspect();

            shadingAspect.SetColor(layer.Color.ToQuantityColor());
            shadingAspect.SetMaterial(Graphic3d_NameOfMaterial.Graphic3d_NOM_PLASTIC.ToAspect());
            shadingAspect.SetTransparency(layer.Transparency);
            attributeSet.Drawer.SetShadingAspect(shadingAspect);

            var lineAspect = new Prs3d_LineAspect(layer.Color.ToQuantityColor(), layer.LineStyle.TypeOfLine(), layer.LineThickness.LineWidth());

            attributeSet.Drawer.SetLineAspect(lineAspect);
            attributeSet.Drawer.SetSeenLineAspect(lineAspect);
            attributeSet.Drawer.SetWireAspect(lineAspect);
            attributeSet.Drawer.SetFaceBoundaryAspect(lineAspect);
            attributeSet.Drawer.SetFreeBoundaryAspect(lineAspect);
            attributeSet.Drawer.SetUnFreeBoundaryAspect(lineAspect);
            attributeSet.Drawer.SetPointAspect(new Prs3d_PointAspect(Aspect_TypeOfMarker.Aspect_TOM_O_POINT, layer.Color.ToQuantityColor(), 2.0));

            attributeSet.Drawer.SetFaceBoundaryDraw(layer.PresentationMode == PresentationMode.SolidWithBoundary);
            attributeSet.Drawer.SetDisplayMode((int)(layer.PresentationMode == PresentationMode.Wireframe ? AIS_DisplayMode.AIS_WireFrame : AIS_DisplayMode.AIS_Shaded));

            attributeSet.Drawer.SetTypeOfDeflection(Aspect_TypeOfDeflection.Aspect_TOD_RELATIVE);

            // Hilight Drawer
            shadingAspect = new Prs3d_ShadingAspect();
            shadingAspect.SetColor(layer.Color.ToQuantityColor());
            shadingAspect.SetMaterial(Graphic3d_NameOfMaterial.Graphic3d_NOM_PLASTIC.ToAspect());
            shadingAspect.SetTransparency(0);
            attributeSet.HilightDrawer.SetShadingAspect(shadingAspect);

            lineAspect = new Prs3d_LineAspect(Colors.Selection, Aspect_TypeOfLine.Aspect_TOL_SOLID, 3.0);
            attributeSet.HilightDrawer.SetLineAspect(lineAspect);
            attributeSet.HilightDrawer.SetSeenLineAspect(lineAspect);
            attributeSet.HilightDrawer.SetWireAspect(lineAspect);
            attributeSet.HilightDrawer.SetFaceBoundaryAspect(lineAspect);
            attributeSet.HilightDrawer.SetFreeBoundaryAspect(lineAspect);
            attributeSet.HilightDrawer.SetUnFreeBoundaryAspect(lineAspect);
            attributeSet.HilightDrawer.SetPointAspect(Marker.CreateBitmapPointAspect(Marker.BallImage, Colors.Selection));

            //TODO attributeSet.HilightDrawer.SetHighlightStyle(new Graphic3d_HighlightStyle(Aspect_TypeOfHighlightMethod.Aspect_TOHM_COLOR, new Quantity_Color(Quantity_NameOfColor.Quantity_NOC_ALICEBLUE)));

            attributeSet.HilightDrawer.SetTypeOfDeflection(Aspect_TypeOfDeflection.Aspect_TOD_RELATIVE);
            attributeSet.HilightDrawer.SetFaceBoundaryDraw(layer.PresentationMode == PresentationMode.SolidWithBoundary);
            attributeSet.HilightDrawer.SetDisplayMode(0);
        }
コード例 #2
0
        //--------------------------------------------------------------------------------------------------

        void _UpdatePresentation()
        {
            _UpdateMarker();

            if (_AisShape == null)
            {
                return;
            }

            var layer = _ShapeSource?.GetLayer();

            if (layer == null)
            {
                return;
            }

            AttributeSet attributeSet;

            if (!_DrawerCache.TryGetValue(layer, out attributeSet))
            {
                attributeSet = new AttributeSet();
                _UpdateAttributesForLayer(layer, ref attributeSet);
                _DrawerCache.SetValue(layer, attributeSet);
            }

            _AisShape.SetAttributes(attributeSet.Drawer);
            //_AisShape.SetHilightAttributes(attributeSet.HilightDrawer);

            _AisShape.SynchronizeAspects();

            if (_Options.HasFlag(Options.Ghosting))
            {
                _UpdatePresentationForGhost();
            }

            //TODO maybe not needed due to call to SynchronizeAspects
            AisContext.RecomputePrsOnly(_AisShape, false, true);
        }