示例#1
0
 private void project_Closed(object sender, EventArgs e)
 {
     if (LayerView != null)
     {
         LayerView.Clear();
     }
 }
 public void RegisterMainGraph(ViewInfo viewInfo, ITreeViewControl treeView, PropertyGridView wpfPropertyGrid,
                               CommandLineView commandLineView, LayerView layerView, IHelpView helpView,
                               BooView booView)
 {
     ActionsGraph = CreateMainGraph(viewInfo, treeView, wpfPropertyGrid, commandLineView, layerView, helpView,
                                    booView);
 }
示例#3
0
        /// <summary>
        /// Loads a topology from a file into the gui.
        /// </summary>
        private void LoadTopology(object sender, EventArgs e)
        {
            openTopology.ShowDialog();
            Dictionary <string, IUserObjectFactory> factories = metaData.GetFactories();
            NetworkSettings settings = new NetworkSettings();
            NetworkTopology topology =
                Topology.Load(openTopology.FileName, ref factories, ref settings,
                              openTopology.FileName.EndsWith(".nntc", true, null));

            topologyMetaData = topology.MetaData;

            AddPreProcessor(null, null);
            GetLayer(0).SetMetaData(topology.PreProcessor.MetaData);

            AddInputLayer(null, null);
            GetLayer(1).SetMetaData(topology.InputLayer.MetaData);

            int row = 2;

            for (int i = 0; i < topology.HiddenLayers.Length; i++)
            {
                AddHiddenLayer(null, null);
                HiddenLayerView layer = (HiddenLayerView)GetLayer(row);
                layer.SetMetaData(topology.HiddenLayers[i].MetaData);
                currentSelectedLayer = layer;


                row++;
            }

            AddOutputLayer(null, null);

            AddPostProcessor(null, null);
        }
示例#4
0
        /// <summary>
        /// Render single line
        /// </summary>
        private void RenderLayer(LayerView layerView)
        {
            var layer = layerView.Layer;

            GUILayout.BeginHorizontal();
            // -- 1 ---------------------------------------------------
            var isVisible = layer.IsVisible;

            if (GUILayout.Button(isVisible ? VisibleIcon : InvisibleIcon, ButtonStyle, IconWidthOption, IconHeightOption))
            {
                layer.IsVisible = !isVisible;
            }
            var isLock = layer.IsLocked;

            if (GUILayout.Button(isLock ? LockIcon : UnlockIcon, ButtonStyle, IconWidthOption, IconHeightOption))
            {
                layer.IsLocked = !isLock;
            }
            // -- 2 ---------------------------------------------------
            layer.Color = EditorGUILayout.ColorField(layer.Color, ColorWidthOption);
            // -- 3 ---------------------------------------------------
            GUILayout.Box(layerView.Icon, ButtonStyle, IconWidthOption, IconHeightOption);
            // -- 4 ---------------------------------------------------
            GUILayout.Label(layer.Name, EditorStyles.largeLabel);
            // -- 5 ---------------------------------------------------
            GUILayout.Label(layerView.Quantity.ToString(), EditorStyles.boldLabel, QuantityWidthOption);

            GUILayout.EndHorizontal();
        }
示例#5
0
        public MainForm()
        {
            InitializeComponent();

            hasOutput        = false;
            hasInput         = false;
            hasPostProcessor = false;
            hasPreProcessor  = false;
            canSave          = false;

            currentSelectedLayer = new LayerView();
            copyLayer            = new LayerView();

            metaData = new MetaDataPoolModel();

            metaData.SetFactory("standard", new StandLibFactory());
            metaData.SetInputLayer("BasicInputLayer");
            metaData.SetHiddenLayer("BasicLayer");
            metaData.SetHiddenLayer("ThreadedHiddenLayer");
            metaData.SetOutputLayer("BasicOutputLayer");
            metaData.SetNode("BasicNode");
            metaData.SetNode("CustomizableNode");
            metaData.SetTrainingAlgorithm("HillClimbAlgo");

            topologyMetaData     = new Dictionary <string, string>();
            topologyMetaDataView = new TopologyMetaDataView(ref metaData);
            topologyMetaDataView.InformationChanged += TopologyMetaDataUpdate;
        }
示例#6
0
        /// <summary>
        /// Creates a copy of the currently selected layer.
        /// </summary>
        private void CopySelectedLayer(object sender, EventArgs e)
        {
            if (currentSelectedLayer.GetType() != typeof(HiddenLayerView))
            {
                MessageBox.Show("You can only copy and paste hidden layers.");
                return;
            }

            copyLayer = (LayerView)((HiddenLayerView)currentSelectedLayer).Clone();
        }
示例#7
0
        /// <summary>
        /// Gets the row of the layer in the topologyDisplay.
        /// </summary>
        /// <param name="layer">The layer to find.</param>
        /// <returns>Returns the row that the layer is at. If the layer could not be
        /// found then -1 is returned.</returns>
        private int GetLayerRow(LayerView layer)
        {
            int row = -1;

            if (topologyDisplay.Controls.Contains(layer))
            {
                row = topologyDisplay.Controls.GetChildIndex(layer, false);
            }

            return(row);
        }
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            LayerView layerView = ProjectView.SelectedLayerView;

            if (layerView == null)
            {
                return;
            }
            var operationIndex = (layerView.SelectedOperationIndex >= 0) ? layerView.SelectedOperationIndex : 0;

            layerView.SelectedLayerViewModel.Collection.Insert(operationIndex, new BaseViewModel("New Operation"));
        }
示例#9
0
        /// <summary>
        /// Changes the currently selected object and changes the meta data view
        /// that is loaded.
        /// </summary>
        private void ChangeInformation(object obj, EventArgs args)
        {
            currentSelectedLayer.BorderStyle = BorderStyle.FixedSingle;
            currentSelectedLayer             = (LayerView)obj;
            currentSelectedLayer.BorderStyle = BorderStyle.Fixed3D;
            Control info = currentSelectedLayer.GetInformation();

            info.Size = topologyContainer.Panel2.Size;
            if (topologyContainer.Panel2.Controls.Count > 0)
            {
                topologyContainer.Panel2.Controls.RemoveAt(0);
            }
            topologyContainer.Panel2.Controls.Add(info);
        }
        private ActionsGraph CreateMainGraph(ViewInfo viewInfo, ITreeViewControl treeView,
                                             PropertyGridView wpfPropertyGrid, CommandLineView commandLineView,
                                             LayerView layerView, IHelpView helpView, BooView booView)
        {
            var result = new ActionsGraph();

            ActionsGraph = result;
            result.Register(this);

            var defaultAppInputs = new DefaultAppInputs(ActionsGraph);

            defaultAppInputs.InitializeInputs(viewInfo, treeView, wpfPropertyGrid, commandLineView, layerView, helpView,
                                              booView);

            return(result);
        }
示例#11
0
        void OnEnable()
        {
            EditorApplication.hierarchyChanged -= CountObjects;
            EditorApplication.hierarchyChanged += CountObjects;
            if (ButtonStyle == null)
            {
                ButtonStyle         = new GUIStyle();
                ButtonStyle.padding = new RectOffset(1, 1, 1, 1);
            }
            if (ArrowDownIcon == null)
            {
                ArrowDownIcon = Resources.Load <Texture>("Icons/arrowDownBlack");
            }
            if (VisibleIcon == null)
            {
                VisibleIcon = Resources.Load <Texture>("Icons/visible");
            }
            if (InvisibleIcon == null)
            {
                InvisibleIcon = Resources.Load <Texture>("Icons/invisible");
            }
            if (LockIcon == null)
            {
                LockIcon = Resources.Load <Texture>("Icons/lock");
            }
            if (UnlockIcon == null)
            {
                UnlockIcon = Resources.Load <Texture>("Icons/unlock");
            }
            if (LayerImage == null)
            {
                LayerImage = Resources.Load <Texture>("Icons/layer");
            }

            // -- initialize all layers --
            var layers = ArtLayers.Layers;

            for (var i = 0; i < layers.Length; i++)
            {
                var layer = layers[i];
                if (layer != null)
                {
                    LayerViews[i] = new LayerView(layer, "Icons/layer");
                }
            }
            CountObjects();
        }
示例#12
0
 public void InitializeInputs(ViewInfo viewInfo, ITreeViewControl treeView, PropertyGridView wpfPropertyView,
                              CommandLineView commandLineView, LayerView layerView, IHelpView helpView,
                              BooView booView)
 {
     ActionGraph.Register(new NodeSelectInput());
     ActionGraph.Register(new UiElementsItem(treeView, wpfPropertyView, layerView, helpView, booView));
     ActionGraph.Register(new ViewInfoInput(viewInfo));
     ActionGraph.Register(new CommandLineInput(commandLineView));
     ActionGraph.Register(new RestrictedPlaneInput());
     ActionGraph.Register(new ClipboardManager());
     ActionGraph.Register(new CommandLinePrePusherInput());
     ActionGraph.Register(new DescriptorsFactoryInput());
     ActionGraph.Register(new FunctionFactoryInput());
     ActionGraph.Register(new OptionsSetupInput());
     ActionGraph.Register(new UiBuilderInput());
     ActionGraph.Register(new CurrentDocumentInput());
     ActionGraph.Register(new GlobalCapabilitiesInput());
 }
示例#13
0
        /// <summary>
        /// Adds a new item to the topology display.
        /// </summary>
        /// <param name="layer">The layer to add to the display.</param>
        /// <param name="row">The location in the display to add it. If
        /// the value is -1 then the layer is added to the end.</param>
        private void AddTableItem(LayerView layer, int row = -1)
        {
            layer.Width  = topologyDisplay.Width - 25;
            layer.Click += new EventHandler(ChangeInformation);

            if (row == -1)
            {
                row = topologyDisplay.Controls.Count;
            }

            topologyDisplay.Controls.Add(layer);
            if (row < topologyDisplay.Controls.Count)
            {
                topologyDisplay.Controls.SetChildIndex(layer, row);
            }

            UpdateSaveStatus();
        }
示例#14
0
        private void LoadConfig()
        {
            //var filepath = FileManager.OpenParamFile();
            //if (filepath.IsEmpty())
            //    return;
            var filepath = "10.tk";
            var content  = System.IO.File.ReadAllText(filepath);
            var tcList   = JsonConvert.DeserializeObject <ObservableCollection <ViewModel.Configs.TCViewModel> >(content);

            string first = "";

            foreach (var tc in tcList)
            {
                //台车
                if (first.IsEmpty())
                {
                    first = tc.Name;
                }

                TabItem item = new TabItem {
                    Name = tc.Name, Header = tc.Name, IsSelected = true
                };
                item.DataContext = tc;

                item.Style = Application.Current.Resources["TabItem.TC"] as System.Windows.Style;

                var list = new ListBox();
                list.ItemContainerStyle = Application.Current.FindResource("layerListBoxItem") as Style;
                foreach (var layer in tc.LayerList)
                {
                    //层
                    LayerView      temp        = new LayerView();
                    LayerViewModel datacontext = new LayerViewModel(tc.Name, filepath, layer, config);
                    datacontext.UUTList = layer.UUTList;
                    datacontext.Refresh();
                    temp.DataContext = datacontext;
                    list.Items.Add(temp);
                }
                item.Content = list;
                TabControl.Items.Add(item);
            }
            TabControl.SetSelectedItem(first);
        }
示例#15
0
        private void InstantiateObjects()
        {
            LayerView layerView_00 = new LayerView("Projetos", true);

            listLayerView.AddListView(layerView_00);

            Connection connection_00 = new Connection("postgres", "zaxscd098", "localhost", "loc2");

            // Proj0001
            QueryView queryView_00 = new QueryView
            {
                Label       = "Talhões",
                IdLayer     = 0,
                Query       = "select st_buffer(geom, 0.01) AS buffer, * FROM talhao where id <= 40",
                Color       = 250,
                CheckedTree = true
            };

            ProjectView projectView_00 = new ProjectView("proj0001", true);

            layerView_00.AddProjectView(projectView_00);
            projectView_00.AddConnection(connection_00);
            projectView_00.AddQueryView(queryView_00);

            // Proj0002
            QueryView queryView_01 = new QueryView
            {
                Label       = "Talhões",
                IdLayer     = 1,
                Query       = "select st_buffer(geom, 0.01) AS buffer, * FROM talhao where id > 40",
                Color       = 200,
                CheckedTree = true
            };

            ProjectView projectView_01 = new ProjectView("proj0002", true);

            layerView_00.AddProjectView(projectView_01);
            projectView_01.AddConnection(connection_00);
            projectView_01.AddQueryView(queryView_01);
        }
示例#16
0
        public void Run(IOccContainerMultiView sceneWorkspace, ActionsGraph actionsGraph, PartModelingView newView,
                        ViewInfo viewInfo)
        {
            _attachedView = sceneWorkspace;
            _actionGraph  = actionsGraph;
            var uiItems =
                _actionGraph[InputNames.UiElementsItem].GetData(NotificationNames.GetValue).Get
                <UiElementsItem.Items>();

            _treeView        = uiItems.TreeView;
            _wpfPropertyView = (PropertyGridView)uiItems.WpfPropertyView;
            _wpfLayerView    = (LayerView)uiItems.LayerView;
            _helpView        = uiItems.HelpView;
            _commandLineView =
                _actionGraph[InputNames.CommandLineView].GetData(NotificationNames.GetValue).Get
                <CommandLineView>();
            _metaModifierContainer = new CommandList(_actionGraph);

            _actionGraph.OnSwitchAction += UpdateSwitchAction;

            Application.DoEvents();
            _actionGraph.Register(new FunctionFactoryInput());
            DefaultFunctions.Setup(_actionGraph);
            var defaultConstraintFunctions = new DefaultConstraintFunctions();

            defaultConstraintFunctions.Setup(_actionGraph);

            OccInitialize.Setup(ref _device, ref _viewer, ref _context, out _view, _attachedView);

            InitDocument();

            _solver = new Solver(_document);
            UpdateSolverOptions();
            ViewInfoSetup(viewInfo);
            RegisterModifiers();
            InitializeInputs();
            DefineShapeConcepts();
            SetupChangedShapeEvent();
            ViewInfoPostSetup();
            UserInterfaceSetup();

            SwitchUserAction(ModifierNames.StartUp);
            var optionsSetup = actionsGraph[InputNames.OptionsSetupInput].Get <OptionsSetup>();

            optionsSetup.Register(new AutoSaveOptionsItem());

            var occSection = optionsSetup.UpdateSectionNode(OptionSectionNames.Background);
            var color      = occSection.GetColorValue(0);

            _viewer.SetDefaultBackgroundColor((ShapeUtils.GetOccColor(color)));
            //SetGradientBackground();


            ForceStartupViewUpdate();

            OptionsEventMapping(optionsSetup);

            var presenter = newView.GetPresenter();

            presenter.OnMouseMoveHandler  += MouseMoveHandler;
            presenter.OnMouseDownHandler  += MouseDownHandler;
            presenter.OnMouseUpHandler    += MouseUpHandler;
            presenter.OnMouseWheelHandler += MouseWheelHandler;

            presenter.OnResizeEvent += ResizeView;

            ApplicationNotificationUtils.Instance.ExitingApplication += () => SwitchUserAction(ModifierNames.NaroExit);

            _view.SurfaceDetail = V3dTypeOfSurfaceDetail.V3d_TEX_ALL;
            new SketchSolveUpdater(_document);


            SetOriginalGradientBackground();

            ResumeRunning();
        }