private AISInteractiveObject UpdateShapeInteractive(Node node, TopoDSShape topoDsShape) { AISInteractiveObject interactiveShape; var haveInteractiveShape = ShapeList.TryGetValue(node.Index, out interactiveShape); if (haveInteractiveShape) { AISShape shape = interactiveShape.Convert <AISShape>(); if (shape != null) { shape.Set(topoDsShape); interactiveShape.Redisplay(false); } } else { interactiveShape = new AISShape(topoDsShape); ShapeList[node.Index] = interactiveShape; if (ShapeUtils.IsPlanarFace(topoDsShape)) { var drawer = interactiveShape.Attributes; var shadingAspect = drawer.ShadingAspect; var shadingAspectAspect = shadingAspect.Aspect; shadingAspectAspect.EdgeColor = (ShapeUtils.GetOccColor(Color.Black)); //shadingAspectAspect.SetEdgeWidth(1); shadingAspectAspect.SetEdgeOn(); } } return(interactiveShape); }
public AISInteractiveObject UpdateNodesInteractive(Node node) { AISInteractiveObject interactive; var haveInteractive = ShapeList.TryGetValue(node.Index, out interactive); if (ShapeIsInvisible(node)) { if (haveInteractive) { RemoveShapeFromContext(node); } return(null); } var isShapeBasedInteractive = false; var topoDsInterpreter = node.Get <TopoDsShapeInterpreter>(); if (topoDsInterpreter != null) { isShapeBasedInteractive = true; var topoDsShape = topoDsInterpreter.Shape; if (topoDsShape == null) { RemoveShapeFromContext(node); return(null); } interactive = UpdateShapeInteractive(node, topoDsShape); } else { if (haveInteractive) { RemoveShapeFromContext(node); } var interactiveShapeInterpreter = node.Get <InteractiveShapeInterpreter>(); //Ensure.IsNotNull(interactiveShapeInterpreter, // "Your node should have either a TopoDS or an InteractiveShape associated to it"); if (interactiveShapeInterpreter == null) { return(null); } interactive = interactiveShapeInterpreter.Interactive; if (interactive == null) { RemoveShapeFromContext(node); return(null); } ShapeList[node.Index] = interactive; } if (Context == null) { return(null); } UpdateInteractiveColor(Context, node, interactive, isShapeBasedInteractive); UpdateTransparency(Context, node, interactive); return(interactive); }
public void RemoveShapeFromContext(Node node) { AISInteractiveObject interactive; var haveInteractive = ShapeList.TryGetValue(node.Index, out interactive); if (!haveInteractive) { return; } if (Context != null) { Context.Remove(interactive, false); } ShapeList.Remove(node.Index); }