Exemplo n.º 1
0
        private void importFileDialog1_FileOk(object sender, CancelEventArgs e)
        {
            var loadImage = new Bitmap(importFileDialog1.FileName);

            PLL.Layer layer = new Layer("Слой " + layers.LayersArray.Length,
                                        new Picture(new Bitmap(loadImage,
                                                               Layers.CurrentLayer.Foreground.EditImage.Width, Layers.CurrentLayer.Foreground.EditImage.Height)),
                                        layers.LayersArray[layers.LayersArray.Length - 1].Foreground);

            layers.AddLayer(layer);
        }
Exemplo n.º 2
0
        private void ProjectMenu_New_Click(object sender, RoutedEventArgs e)
        {
            CreateProjectHost CPH = new CreateProjectHost(CurrentProject.GetBasinNames());

            CPH.Owner = this;
            CPH.Show();

            if (CurrentProject != null)
            {
                Layers.AddLayer("Background");
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// RESTORE BINDINGS ONCE THREADING ISSUES FIGURED OUT
 /// </summary>
 /// <param name="Name"></param>
 public void AddLayer(string Name)
 {
     Layers.AddLayer(Name, true);
     Layers.UpdateLayout();
 }
Exemplo n.º 4
0
        public void AddDefaultClusterLayers()
        {
            string[] sViewVisUndo = new List <string>().AddReturn(ModelingHistory.ViewCommands, ModelingHistory.VisibilityCommands, ModelingHistory.GUICommands).AddReturn("view", "undo.undo", "gui", "viewvis").ToArray();
            //string[] sViewVisUndoSelect = new List<string>().AddReturn( ModelingHistory.ViewCommands, ModelingHistory.VisibilityCommands, ModelingHistory.SelectionCommands, ModelingHistory.GUICommands ).AddReturn( "view", "undo.undo", "select", "gui" ).ToArray();
            string[] sSelections = new List <string>().AddReturn(ModelingHistory.SelectionCommands).AddReturn("select").ToArray();
            string[] sTransforms = new List <string>().AddReturn(ModelingHistory.TransformCommands).AddReturn("transform").ToArray();
            string[] sTopoA      = ModelingHistory.TopoGroupA;
            string[] sTopoB      = ModelingHistory.TopoGroupB;
            //string[] sExtrudes = new string[] { "topo.extrude" };
            //string[] sAddEdgeFace = new string[] { "topo.add.edge_face" };
            //string[] sGeoTopoOps = new List<string>().AddReturn( ModelingHistory.TransformCommands ).AddReturn( ModelingHistory.TopoCommands ).ToArray();
            string[] sGeoTopoNonPosOps = new List <string>().AddReturn(ModelingHistory.TransformCommands).AddReturn(ModelingHistory.TopoCommands).ToArray();                //TopoNonPosCommands
            string[] sTopoAddOps       = ModelingHistory.TopoPosCommands;

            SolidBrush brDarkGreen = new SolidBrush(Color.FromArgb(0, 128, 0));
            SolidBrush brCyan      = new SolidBrush(Color.FromArgb(0, 255, 255));

            //SolidBrush brOrange = new SolidBrush( Color.FromArgb( 255, 192, 0 ) );

            System.Console.Write("Performing default clustering...");

            Clustering clusterUndos = new ClusteringUndos(this);

            Clustering clusterViews = new ClusteringPredicate_StartsWith("view", this, "Cluster Camera");
            //Clustering clusterNonChanges = new ClusteringPredicate_Hide( this, "Cluster Nonchanges", sViewVisUndo );
            Clustering clusterViewVis    = new ClusteringPredicate_MixedRepeats("view", sViewVisUndo, brDarkGreen, Composition.GetPreset(CompositionPresets.Default), history, "Cluster Visibility");
            Clustering clusterSelections = new ClusteringPredicate_RepeatsWithIgnorable_UseLast("select", brDarkGreen, Composition.GetPreset(CompositionPresets.Default), sSelections, sViewVisUndo, this, "Cluster Selection");
            //Clustering clusterNonChangeSelect = new ClusteringPredicate_PairWithIgnorable_UseLast( sViewVisUndo, new string[] { "select" },  new string[] { }, false, false, true, history, "Cluster Non-changes" );

            //Clustering clusterSelectAdd = new ClusteringPredicate_PairWithIgnorable_UseLast( sSelections, sTopoAddOps, sViewVisUndo, false, false, false, true, history, "Cluster Select+Add" );
            Clustering clusterSelectOp = new ClusteringPredicate_PairWithIgnorable_UseLast(sSelections, sGeoTopoNonPosOps, sViewVisUndo, false, false, false, false, history, "Cluster Selection+Operation");

            Clustering clusterTransforms = new ClusteringPredicate_RepeatsWithIgnorable("transform", brCyan, Composition.GetPreset(CompositionPresets.Transform), sTransforms, sViewVisUndo, this, "Cluster Repeated Transform");
            Clustering clusterRepeats1   = new ClusteringPredicate_Repeats2(sViewVisUndo, this, "Cluster Repeated Operations");

            //Clustering clusterExtrudes = new ClusteringPredicate_RepeatsWithIgnorable( "topo.extrude", brOrange, Composition.GetPreset( CompositionPresets.Extrude ), sExtrudes, sViewVisUndo, this, "Cluster Repeated Extrudes" );
            //Clustering clusterExtrudeAddFace = new ClusteringPredicate_PairWithIgnorable( "topo.extrude", brOrange, Composition.GetPreset( CompositionPresets.Extrude ), sExtrudes, sAddEdgeFace, sViewVisUndo, false, true, false, history, "Cluster Extrude+Add Face" );
            Clustering clusterTopoTransform = new ClusteringPredicate_PairWithIgnorable_UseFirst(ModelingHistory.TopoNonNegCommands, sTransforms, sViewVisUndo, false, false, false, history, "Cluster Topology+Transform");
            Clustering clusterTopoATopoB    = new ClusteringPredicate_PairWithIgnorable_UseFirst(sTopoA, sTopoB, sViewVisUndo, false, true, false, history, "Cluster Structural Changes");

            Clustering clusterRepeats2 = new ClusteringPredicate_Repeats2(sViewVisUndo, this, "Cluster Repeated Structural Changes");

            //Clustering clusterSelectTransform = new ClusteringPredicate_PairWithIgnorable( "transform", brCyan, Composition.GetPreset( CompositionPresets.Transform ), sSelections, sTransforms, sViewVisUndo, true, true, true, this, "Cluster Select+Transform" );
            //Clustering clusterSelectExtrude = new ClusteringPredicate_PairWithIgnorable( "topo.extrude", brOrange, Composition.GetPreset( CompositionPresets.Extrude ), sSelections, sExtrudes, sViewVisUndo, true, true, true, this, "Cluster Select+Extrude" );
            //Layers.AddLayer( clusterSelectTransform );
            //Layers.AddLayer( clusterSelectExtrude );

            Layers.AddLayer(clusterUndos);                              // 1

            Layers.AddLayer(clusterViews);                              // 2
            Layers.AddLayer(clusterViewVis);                            // 3
            Layers.AddLayer(clusterSelections);                         // 4
            //Layers.AddLayer( clusterNonChangeSelect );	// 5

            //Layers.AddLayer( clusterSelectAdd );		// 5
            Layers.AddLayer(clusterSelectOp);                       // 6

            Layers.AddLayer(clusterTransforms);                     // 7
            Layers.AddLayer(clusterRepeats1);                       // 8

            Layers.AddLayer(clusterTopoTransform);                  // 9
            Layers.AddLayer(clusterTopoATopoB);                     // 10
            Layers.AddLayer(clusterRepeats2);                       // 11

            //if( ModelingHistory.ClusterLayers ) {
            //	ClusteringLayerNames.Add( "Original" ); ClusteringLayerLevels.Add( 0 );
            //	ClusteringLayerNames.Add( "Cluster Undone Work" ); ClusteringLayerLevels.Add( clusterUndos.Level );
            //	ClusteringLayerNames.Add( "Cluster Non-changes to Mesh" ); ClusteringLayerLevels.Add( clusterSelections.Level );
            //	ClusteringLayerNames.Add( "Cluster Selections with next change" ); ClusteringLayerLevels.Add( clusterSelectOp.Level );
            //	ClusteringLayerNames.Add( "Cluster Repeated Homogeneous Ops" ); ClusteringLayerLevels.Add( clusterRepeats1.Level );
            //	ClusteringLayerNames.Add( "Cluster Repeated Operation Groups" ); ClusteringLayerLevels.Add( clusterRepeats2.Level );
            //} else {
            //	for( Clustering c = Layers.GetClusteringLayer( 0 ); c != null; c = c.Above )
            //	{
            //		ClusteringLayerNames.Add( c.Label );
            //		ClusteringLayerLevels.Add( c.Level );
            //	}
            //}

            for (Clustering c = Layers.GetClusteringLayer(0); c != null; c = c.Above)
            {
                ClusteringLayerNames.Add(c.Label);
                ClusteringLayerLevels.Add(c.Level);
            }


            //if( AddClusterByConnection )
            //{
            //	Clustering clusterComponents = new ClusteringPredicate_Connected( this, "Cluster Connected Components" );
            //	Layers.AddLayer( clusterComponents );	// 13
            //	//if( clusterComponents.clusters.Count < 5 ) { System.Console.WriteLine( "Too few components.  Removing cluster by connected components" ); Layers.RemoveLevel( Layers.nlevels - 1 ); }

            //	ClusteringLayerNames.Add( "Cluster by Connected Components" ); ClusteringLayerLevels.Add( clusterComponents.Level );
            //}

            //if( AddCustomHelmetLayer )
            //{
            //	ClusteringCustom clusterCustom = new ClusteringCustom( history, "Custom" );
            //	clusterCustom.clusters.Add( new Cluster( 0, 647, "Chin", Composition.GetPreset( CompositionPresets.MeshDiff ) ) );
            //	clusterCustom.clusters.Add( new Cluster( 648, 1013, "Nose", Composition.GetPreset( CompositionPresets.MeshDiff ) ) );
            //	clusterCustom.clusters.Add( new Cluster( 1014, 1253, "Forehead", Composition.GetPreset( CompositionPresets.MeshDiff ) ) );
            //	clusterCustom.clusters.Add( new Cluster( 1254, 1359, "Ear", Composition.GetPreset( CompositionPresets.MeshDiff ) ) );
            //	clusterCustom.clusters.Add( new Cluster( 1360, 4619, "Back of Head", Composition.GetPreset( CompositionPresets.MeshDiff ) ) );
            //	clusterCustom.clusters.Add( new Cluster( 4620, 4917, "Ear", Composition.GetPreset( CompositionPresets.MeshDiff ) ) );
            //	clusterCustom.clusters.Add( new Cluster( 4918, 5836, "Thickness", Composition.GetPreset( CompositionPresets.MeshDiff ) ) );
            //	clusterCustom.clusters.Add( new Cluster( 5837, 7094, "Details", Composition.GetPreset( CompositionPresets.MeshDiff ) ) );
            //	clusterCustom.clusters.Add( new Cluster( 7095, 8165, "Eye Lens", Composition.GetPreset( CompositionPresets.MeshDiff ) ) );
            //	clusterCustom.clusters.Add( new Cluster( 8166, 8511, "Fill-in", Composition.GetPreset( CompositionPresets.MeshDiff ) ) );
            //	Layers.AddLayer( clusterCustom );

            //	ClusteringLayerNames.Add( "Custom Clustering" ); ClusteringLayerLevels.Add( clusterCustom.Level );
            //}

            System.Console.WriteLine("done");

            CurrentLevel.Set(Layers.GetClusteringLayer());

            //Thread processthread = new Thread( CacheTopLayers );
            //processthread.Start();
            CacheTopLayers();
        }
Exemplo n.º 5
0
 /// <summary>
 /// Temp
 /// </summary>
 private void Init_InitLayers()
 {
     Layers.AddLayer("Background");
 }