protected override void OnReceiveInputData(string inputName, object data) { if (inputName == ActionNames.View2dInput) { if (View2d == null) { View2d = data as OCV2d_View; } else { Viewer2d = data as OCV2d_Viewer; } } }
/// <summary> /// Initializes the OpenCascade views and assigns them View handles. /// </summary> private void InitializeOpenCascade2D() { // Initialize the Device try { device2d = new OCWNT_GraphicDevice(false, 0); Debug.Assert(device2d != null); } catch (Exception ex) { Debug.Assert(false, ex.Message); throw; //re-throw exception } // Create the 2D viewer try { viewer2d = new OCV2d_Viewer(device2d, "Visu2D", ""); Debug.Assert(viewer2d != null); if (viewer2d != null) { viewer2d.SetCircularGridValues(0, 0, 10, 8, 0); viewer2d.SetRectangularGridValues(0, 0, 10, 10, 0); //viewer2d.SetGridColor(new OCQuantity_Color(OCQuantity_NameOfColor.Quantity_NOC_LIGHTSLATEGRAY), new OCQuantity_Color(OCQuantity_NameOfColor.Quantity_NOC_WHITE)); viewer2d.ActivateGrid(OCAspect_GridType.Aspect_GT_Rectangular, OCAspect_GridDrawMode.Aspect_GDM_Lines); } } catch (Exception ex) { Debug.Assert(false, ex.Message); throw; //re-throw exception } // Create the 2D interactive context try { context2d = new OCAIS2D_InteractiveContext(this.viewer2d); Debug.Assert(context2d != null); } catch (Exception ex) { Debug.Assert(false, ex.Message); throw; // re-throw exception } // Create the 2D View OCWNT_Window aWNTWindow = new OCWNT_Window(device2d, attachedView.GetView().Handle, OCQuantity_NameOfColor.Quantity_NOC_MATRAGRAY); //int w = 1000, h = 1000; //aWNTWindow.Size(w, h); if (!aWNTWindow.IsMapped()) { aWNTWindow.Map(); } OCWNT_WDriver aDriver = new OCWNT_WDriver(aWNTWindow); view2d = new OCV2d_View(aDriver, viewer2d, 0, 0, 200); // Reset the mapping view2d.Reset(); view2d.Update(); }
public View2dInput(OCV2d_View view, OCV2d_Viewer viewer) : base(ActionNames.View2dInput) { _view = view; _viewer = viewer; }
public OCCMouseEventsPipe(OCV2d_View view, OCV2d_Viewer viewer) : base(ActionNames.OCCMouseCoordinates) { _view2d = view; _viewer2d = viewer; }