示例#1
0
        private void CreateInstances() // [Step 1] --------------------------------------------------------------- ###
        {
            result = new ImageForm
            {
                // ImageForm layout Elements:
                form               = new Form(),
                MenuContainer      = new Panel(),
                containerWorkspace = new SplitContainer(),
                progressBar        = new ProgressBar(),
                menuStrip          = new MenuStrip(),

                // Extended Panels:
                imageLeftWingPanel = ImageView_Builder.GetResult(),
                infoRightWingPanel = InfoView_Builder.GetResult()

                                     //modifications = new List<ImageData>()
            };
        }
示例#2
0
        private TabPage AddTabPage(KoreFileInfo kfi, Color tabColor, KoreFileInfo parentKfi = null)
        {
            var tabPage = new TabPage
            {
                BackColor = SystemColors.Window,
                Padding   = new Padding(0, 2, 2, 1)
            };

            IKuriimuForm tabControl = null;

            if (kfi.Adapter is ITextAdapter)
            {
                tabControl = new TextForm(kfi, tabPage, parentKfi?.Adapter as IArchiveAdapter, GetTabPageForKfi(parentKfi), _kore.GetAdapters <IGameAdapter>());
            }
            else if (kfi.Adapter is IImageAdapter)
            {
                tabControl = new ImageForm(kfi, tabPage, parentKfi?.Adapter as IArchiveAdapter, GetTabPageForKfi(parentKfi));
            }
            else if (kfi.Adapter is IArchiveAdapter)
            {
                tabControl = new ArchiveForm(kfi, tabPage, parentKfi?.Adapter as IArchiveAdapter, GetTabPageForKfi(parentKfi), _tempFolder, _kore.PluginLoader);
                (tabControl as IArchiveForm).OpenTab        += Kuriimu2_OpenTab;
                (tabControl as IArchiveForm).GetAdapterById += Kuriimu2_GetAdapterById;
            }
            tabControl.TabColor = tabColor;

            if (tabControl is UserControl uc)
            {
                uc.Dock = DockStyle.Fill;
            }

            tabControl.SaveTab        += TabControl_SaveTab;
            tabControl.CloseTab       += TabControl_CloseTab;
            tabControl.ReportProgress += Report_ProgressChanged;

            tabPage.Controls.Add(tabControl as UserControl);

            openFiles.TabPages.Add(tabPage);
            tabPage.ImageKey      = "close-button"; // setting ImageKey before adding, makes the image not working
            openFiles.SelectedTab = tabPage;

            return(tabPage);
        }
示例#3
0
        private IAssetTool CreateAssetTool(AssetType assetType)
        {
            IAssetTool newAssetTool;

            switch (assetType)
            {
            case AssetType.video:
                newAssetTool = new VideoForm();
                (newAssetTool as VideoForm).Show();
                break;

            case AssetType.webpage:
                newAssetTool = new WebPageTool();
                break;

            case AssetType.flash:
                newAssetTool = new FlashForm();
                (newAssetTool as FlashForm).Show();
                break;

            case AssetType.app:
                newAssetTool = new AppTool();
                break;

            case AssetType.image:
                newAssetTool = new ImageForm();
                (newAssetTool as ImageForm).Show();
                break;

            case AssetType.ppt:
                //newAssetTool = new PointApp.AssetTool.PPTTool();
                newAssetTool = PPTTool.GetInstance();
                break;

            default:
                newAssetTool = null;
                break;
            }
            return(newAssetTool);
        }
示例#4
0
        public FilesForm()
        {
            this.WindowState = FormWindowState.Maximized;
            InitializeComponent();
            videoFiles = new List <string>();
            string folderName = SysConfig.GetSysConfig().StorePath;

            string[] extesnsions = new string[] { ".png", ".avi" };
            var      files       = GetFiles(folderName, extesnsions, SearchOption.TopDirectoryOnly);

            //this.imageListView.View = Manina.Windows.Forms.View.Gallery;
            foreach (var file in files)
            {
                imageListView.Items.Add(file.ToString());
                if (Path.GetExtension(file.ToString()) == ".avi")
                {
                    videoFiles.Add(file.ToString());
                }
            }
            imageForm = new ImageForm();
            imageForm.DeleteImageItemHandler += DeleteImageItemHandler;
        }
示例#5
0
 private void imageListView_ItemDoubleClick(object sender, ItemClickEventArgs e)
 {
     try
     {
         ImageListViewItem item = this.imageListView.Items.FocusedItem;
         if (item != null)
         {
             var fileExtension = Path.GetExtension(item.FileName);
             if (fileExtension == ".avi")
             {
                 string fileName = item.FileName;
                 int    v        = videoFiles.FindIndex(file => { return(file == fileName); });
                 videoForm = new VideoForm(videoFiles, fileName);
                 videoForm.ShowDialog();
             }
             else if (fileExtension == ".png")
             {
                 string fileName = item.FileName;
                 imageForm = new ImageForm();
                 imageForm.DeleteImageItemHandler += DeleteImageItemHandler;
                 imageForm.Text = item.Text;
                 imageForm.ImageListViewItem = item;
                 imageForm.FileName          = fileName;
                 DialogResult dr = imageForm.ShowDialog();
                 if (dr == DialogResult.OK && imageForm.IsAssign)
                 {
                     DeleteImageItemHandler(item);
                     File.Delete(item.FileName);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         LogHelper.GetLogger <FilesForm>().Error(ex.Message);
         LogHelper.GetLogger <FilesForm>().Error(ex.StackTrace);
     }
 }
        public CharScopeNine() : base(86, 86)
        {
            SetImage(new Tex2D("Corona/Entity/Chars/ScopeNine/Idle1.png", true));
            CastShadow   = true;
            WeaponHudImg = new Texture2D("Corona/img/icon/weaponhud1.png", LoadMethod.Single, true);
            PulseAimImg  = new Tex2D("Corona/img/icon/pulseaim1.png", true);
            CurProjImg   = new Texture2D("Corona/img/icon/curproj.png", LoadMethod.Single, true);
            ChangeSrc    = Vivid.Audio.Songs.LoadSound("Corona/sound/hud/projchange.mp3");
            HudTop       = new UIForm().Set(0, 0, AppInfo.W, AppInfo.H);

            WH[0] = new ImageForm().Set(20, 20, 44, 44).SetImage(WeaponHudImg) as ImageForm;
            WH[1] = new ImageForm().Set(66, 20, 44, 44).SetImage(WeaponHudImg) as ImageForm;
            WH[2] = new ImageForm().Set(110, 20, 44, 44).SetImage(WeaponHudImg) as ImageForm;


            UI.CurUI.Top = HudTop;



            HudTop.Add(WH[0]);
            HudTop.Add(WH[1]);
            HudTop.Add(WH[2]);

            Slots[0] = new BigShotProjector();
            Slots[1] = new LongShotProjector();


            RebuildWeaponHud();

            Z           = 1;
            ShadowPlane = 1;
            AddAnim("Walk1", new SpriteAnim("Corona/Entity/Chars/ScopeNine/AnimWalk/", 0.5f));
            AddAnim("Run1", new SpriteAnim("Corona/Entity/Chars/ScopeNine/AnimWalk/", 1.0f));
            AddAnim("Idle1", new SpriteAnim("Corona/Entity/Chars/ScopeNine/AnimIdle1/", 0.35f));
            SetAnim("Idle1");
            ImgFrame = GetAnimFrame();
            Drag     = 0.94f;
        }
示例#7
0
        public override void InitState()
        {
            base.InitState();

            var win = new WindowForm().Set(50, 50, 450, 300, "FoomED");

            var bg = new ImageForm().Set(0, 0, AppInfo.W, AppInfo.H, "").SetImage(new Texture2D("FoomED/bg1.jpg", LoadMethod.Single, false));

            SUI = new UI();

            var new_map = new ButtonForm().Set(10, 40, 120, 30, "New Map");

            win.Add(new_map);

            SUI.Root.Add(bg);

            SUI.Root.Add(win);

            new_map.Click = (b) =>
            {
                FusionApp.PushState(new NewMapState());
            };
        }
示例#8
0
        private void SetUpContextMenuStrips()
        {
            ControlUtilities.AddContextMenuStripFunctions(
                labelVersionNumber,
                new List <string>()
            {
                "Open Mapping",
                "Clear Mapping",
                "Inject Hitbox View Code",
                "Free Movement Action",
                "Everything in File",
                "Go to Closest Floor Vertex",
                "Save as Savestate",
                "Show MHS Vars",
                "Download Latest STROOP Release",
                "Documentation",
                "Show All Helpful Hints",
                "Enable TASer Settings",
                "Show Image Form",
                "Show Coin Ring Display Form",
                "Format Subtitles",
            },
                new List <Action>()
            {
                () => MappingConfig.OpenMapping(),
                () => MappingConfig.ClearMapping(),
                () => gfxTab.InjectHitboxViewCode(),
                () => Config.Stream.SetValue(MarioConfig.FreeMovementAction, MarioConfig.StructAddress + MarioConfig.ActionOffset),
                () => fileTab.DoEverything(),
                () => trianglesTab.GoToClosestVertex(),
                () => saveAsSavestate(),
                () =>
                {
                    string varFilePath = @"Config/MhsData.xml";
                    List <WatchVariableControlPrecursor> precursors =
                        XmlConfigParser.OpenWatchVariableControlPrecursors(varFilePath);
                    List <WatchVariableControl> controls = precursors.ConvertAll(
                        precursor => precursor.CreateWatchVariableControl());
                    VariablePopOutForm form = new VariablePopOutForm();
                    form.Initialize(controls);
                    form.ShowForm();
                },
                () => Process.Start("https://github.com/SM64-TAS-ABC/STROOP/releases/download/vDev/STROOP.zip"),
                () => Process.Start("https://ukikipedia.net/wiki/STROOP"),
                () => HelpfulHintUtilities.ShowAllHelpfulHints(),
                () =>
                {
                    tasTab.EnableTASerSettings();
                    tabControlMain.SelectedTab = tabPageTas;
                },
                () =>
                {
                    ImageForm imageForm = new ImageForm();
                    imageForm.Show();
                },
                () =>
                {
                    CoinRingDisplayForm form = new CoinRingDisplayForm();
                    form.Show();
                },
                () => SubtitleUtilities.FormatSubtitlesFromClipboard(),
            });

            ControlUtilities.AddCheckableContextMenuStripFunctions(
                labelVersionNumber,
                new List <string>()
            {
                "Update Cam Hack Angle",
                "Update Floor Tri",
            },
                new List <Func <bool> >()
            {
                () =>
                {
                    TestingConfig.UpdateCamHackAngle = !TestingConfig.UpdateCamHackAngle;
                    return(TestingConfig.UpdateCamHackAngle);
                },
                () =>
                {
                    TestingConfig.UpdateFloorTri = !TestingConfig.UpdateFloorTri;
                    return(TestingConfig.UpdateFloorTri);
                },
            });

            ControlUtilities.AddContextMenuStripFunctions(
                buttonMoveTabLeft,
                new List <string>()
            {
                "Restore Recommended Tab Order"
            },
                new List <Action>()
            {
                () => SavedSettingsConfig.InvokeRecommendedTabOrder()
            });

            ControlUtilities.AddContextMenuStripFunctions(
                buttonMoveTabRight,
                new List <string>()
            {
                "Restore Recommended Tab Order"
            },
                new List <Action>()
            {
                () => SavedSettingsConfig.InvokeRecommendedTabOrder()
            });

            ControlUtilities.AddContextMenuStripFunctions(
                trackBarObjSlotSize,
                new List <string>()
            {
                "Reset to Default Object Slot Size"
            },
                new List <Action>()
            {
                () =>
                {
                    trackBarObjSlotSize.Value = ObjectSlotsManager.DefaultSlotSize;
                    ChangeObjectSlotSize(ObjectSlotsManager.DefaultSlotSize);
                }
            });
        }
示例#9
0
        public async Task <HttpResponseMessage> Upload([FromBody] ImageForm imageForm)
        {
            await _imageRepository.UploadImage(imageForm.ImageId, imageForm.ImageData);

            return(Request.CreateResponse(HttpStatusCode.OK));
        }
示例#10
0
        public override void Run()
        {
            // 显示设置参数窗口
            var setUpForm = new AnnCaSetUpForm();

            setUpForm.ShowDialog();

            if (setUpForm.DialogResult != DialogResult.OK)
            {
            }
            else
            {
                // 获得参数
                string        beginLayerName  = setUpForm.beginLayerName;
                string        endLayerName    = setUpForm.endLayerName;
                List <string> driveLayerNames = setUpForm.driveLayerNames;

                int    numOfSample   = setUpForm.NumOfSample;
                int    numOfTrain    = setUpForm.NumOfTrain;
                int    numOfSimulate = setUpForm.NumOfSimulate;
                double threshold     = setUpForm.Threshold;
                double alpha         = setUpForm.Alpha;

                LandUseClassificationInfo landInfo = setUpForm.LandUse;

                // 显示控制台
                this.consolePad = WorkbenchSingleton.Workbench.GetPad(typeof(ConsolePad)).PadContent.Control as GIS.Common.Dialogs.Console.Console;

                WorkbenchSingleton.Workbench.GetPad(typeof(ConsolePad)).BringPadToFront();

                //string beginLayerName = "2001";
                //string endLayerName = "2006";
                //List<string> driveLayerNames = new List<string>() { "dem", "distocity", "distohighway", "distorailway", "distoroad", "distotown", "slope" };

                if (landInfo == null)
                {
                    landInfo          = new LandUseClassificationInfo();
                    landInfo.NullInfo = new StructLanduseInfo()
                    {
                        LandUseTypeColor = Color.White.ToArgb(), LandUseTypeName = "NULL", LandUseTypeValue = -3.40282306074e+038
                    };
                    landInfo.AllTypes = new List <StructLanduseInfo>()
                    {
                        new StructLanduseInfo()
                        {
                            LandUseTypeName = "城市", LandUseTypeValue = 1, LandUseTypeColor = Color.Black.ToArgb()
                        },
                        new StructLanduseInfo()
                        {
                            LandUseTypeName = "水", LandUseTypeValue = 2, LandUseTypeColor = Color.Blue.ToArgb()
                        },
                        new StructLanduseInfo()
                        {
                            LandUseTypeName = "田", LandUseTypeValue = 3, LandUseTypeColor = Color.Yellow.ToArgb()
                        },
                        new StructLanduseInfo()
                        {
                            LandUseTypeName = "森林", LandUseTypeValue = 4, LandUseTypeColor = Color.Green.ToArgb()
                        },
                        new StructLanduseInfo()
                        {
                            LandUseTypeName = "果园", LandUseTypeValue = 5, LandUseTypeColor = Color.LightPink.ToArgb()
                        }
                    };
                }



                // 设置网络
                var network = new AnnCa(beginLayerName, endLayerName, driveLayerNames, landInfo);
                network.NumOfSamples = numOfSample;
                network.TimesOfTrain = numOfTrain;
                network.Threshold    = threshold;
                network.Alpha        = alpha;


                network.updateConsoleEvent += this.UpdateConsole;
                network.updateImageEvent   += this.UpdateImage;

                // 设置图像显示
                this.imageForm = new ImageForm(network.BeginBuffer, network.Width, network.Height, landInfo);
                this.imageForm.Show();
                // 开始模拟
                Thread threadSimulate = new Thread(new ParameterizedThreadStart(network.Run));
                threadSimulate.IsBackground = true;
                threadSimulate.Start(numOfSimulate);
            }
        }
示例#11
0
        public override void Run()
        {
            // 读取设置参数
            var form = new DTCaSetUpForm();

            form.ShowDialog();

            if (form.DialogResult != DialogResult.OK)
            {
            }
            else
            {
                var inputColumnNames = form.driveLayerNames;
                var outputColumnName = form.beginLayerName;
                LandUseClassificationInfo landUseInfo = form.LandUse;
                if (landUseInfo == null)
                {
                    landUseInfo          = new LandUseClassificationInfo();
                    landUseInfo.AllTypes = new List <StructLanduseInfo>()
                    {
                        new StructLanduseInfo()
                        {
                            LandUseTypeName = "城市", LandUseTypeValue = 1.0, LandUseTypeColor = Color.Black.ToArgb()
                        },
                        new StructLanduseInfo()
                        {
                            LandUseTypeName = "非城市", LandUseTypeValue = 0.0, LandUseTypeColor = Color.White.ToArgb()
                        },
                        new StructLanduseInfo()
                        {
                            LandUseTypeName = "水体", LandUseTypeValue = 2.0, LandUseTypeColor = Color.Blue.ToArgb()
                        },
                    };
                    landUseInfo.ConvertableInfos.Add(new StructLanduseInfo()
                    {
                        LandUseTypeName = "非城市", LandUseTypeValue = 0.0, LandUseTypeColor = Color.White.ToArgb()
                    });
                    landUseInfo.NullInfo = new StructLanduseInfo()
                    {
                        LandUseTypeName = "空值", LandUseTypeValue = -9999.0, LandUseTypeColor = Color.Transparent.ToArgb()
                    };
                    landUseInfo.UnConvertableInfos.Add(new StructLanduseInfo()
                    {
                        LandUseTypeName = "水体", LandUseTypeValue = 2.0, LandUseTypeColor = Color.Blue.ToArgb()
                    });
                    landUseInfo.UrbanInfos.Add(new StructLanduseInfo()
                    {
                        LandUseTypeName = "城市", LandUseTypeValue = 1.0, LandUseTypeColor = Color.Black.ToArgb()
                    });
                }

                // 初始化控制台
                this.consolePad = WorkbenchSingleton.Workbench.GetPad(typeof(ConsolePad)).PadContent.Control as GIS.Common.Dialogs.Console.Console;
                // 显示控制台
                WorkbenchSingleton.Workbench.GetPad(typeof(ConsolePad)).BringPadToFront();

                // 初始化树
                var tree = new CaDecisionTree(inputColumnNames, outputColumnName);
                tree.updateConsoleInfoEvent += UpdateConsole;
                tree.updateImageEvent       += UpdateImage;
                tree.LandUseInfo             = landUseInfo;
                tree.SampleRate              = form.RateOfSample;
                // 显示模拟图像
                this.imageForm        = new ImageForm(tree.OuputBuffer, tree.Width, tree.Height, landUseInfo);
                this.imageForm.Width  = tree.Width;
                this.imageForm.Height = tree.Height;
                imageForm.Show();
                // 开始训练模拟
                Thread threadSimulate = new Thread(new ParameterizedThreadStart(tree.Run));
                threadSimulate.IsBackground = true;
                threadSimulate.Start(form.NumOfSimulate);
            }
        }
示例#12
0
        public void ShowView(string viewName, string viewParametr)
        {
            ImageForm imageView = new ImageForm(viewParametr);

            imageView.Show();
        }
示例#13
0
        public MoveNodeForm()

        {
            if (up == null)
            {
                up    = new Texture2D("content/edit/up.png", LoadMethod.Single, true);
                down  = new Texture2D("content/edit/down.png", LoadMethod.Single, true);
                left  = new Texture2D("content/edit/left.png", LoadMethod.Single, true);
                right = new Texture2D("content/edit/right.png", LoadMethod.Single, true);
            }

            ImageForm uform = new ImageForm().Set(0, 0, 32, 32).SetImage(up) as ImageForm;
            ImageForm lform = new ImageForm().Set(0, 0, 32, 32).SetImage(left) as ImageForm;
            ImageForm rform = new ImageForm().Set(0, 0, 32, 32).SetImage(right) as ImageForm;
            ImageForm dform = new ImageForm().Set(0, 0, 32, 32).SetImage(down) as ImageForm;

            Add(uform);
            Add(lform);
            Add(rform);
            Add(dform);
            bool mup    = false;
            bool mleft  = false;
            bool mright = false;
            bool mdown  = false;


            rform.MouseDown = (b) =>
            {
                mright = true;
            };
            rform.MouseUp = (b) =>
            {
                mright = false;
            };

            rform.MouseMove = (x, y, xd, yd) =>
            {
                if (Node != null && mright)
                {
                    Node.X = Node.X + xd;
                    View.UpdateGraph();
                }
            };


            dform.MouseDown = (b) =>
            {
                mdown = true;
            };
            dform.MouseUp = (b) =>
            {
                mdown = false;
            };

            dform.MouseMove = (x, y, xd, yd) =>
            {
                if (Node != null && mdown)
                {
                    Node.Y = Node.Y + yd;
                    View.UpdateGraph();
                }
            };


            lform.MouseDown = (b) =>
            {
                mleft = true;
            };
            lform.MouseUp = (b) =>
            {
                mleft = false;
            };

            lform.MouseMove = (x, y, xd, yd) =>
            {
                if (Node != null && mleft)
                {
                    Node.X = Node.X + xd;
                    View.UpdateGraph();
                }
            };

            uform.MouseDown = (b) =>
            {
                mup = true;
            };
            uform.MouseUp = (b) =>
            {
                mup = false;
            };

            uform.MouseMove = (x, y, xd, yd) =>
            {
                if (Node != null && mup)
                {
                    Node.Y = Node.Y + yd;
                    View.UpdateGraph();
                }
            };

            AfterSet = () =>
            {
                uform.Set(32, 0, 32, 32);
                lform.Set(0, 32, 32, 32);
                rform.Set(64, 32, 32, 32);
                dform.Set(32, 64, 32, 32);
            };
        }
示例#14
0
 public IHttpActionResult upload(ImageForm imgForm)
 {
     return(Ok(ftp_Module.UploadImage(Convert.FromBase64String(imgForm.base64))));
 }
示例#15
0
 public void ShowWindow(ImageForm imageWindow)
 {
     imageWindow.form.WindowState = FormWindowState.Normal;
     imageWindow.form.Activate();
 }
示例#16
0
        public override void InitState()
        {
            base.InitState();
            MenuSongSrc   = new VSoundSource("Foom/Song/intro1.mp3");
            MenuSongSound = MenuSongSrc.Play2D(true);

            var img = new ImageForm().Set(300, 800, 300, 300, "").SetImage(new Texture2D("Foom/Img/Intro/img1.jpg", LoadMethod.Single, true));

            UI.BootAlpha = 0.0f;
            int tc = 0;

            void ImgUp1()
            {
                img.Y = img.Y - 3;
            }

            bool ImgUpR()
            {
                if (img.Y < 200)
                {
                    return(true);
                }
                return(false);
            }

            void Img1Text()
            {
            }

            bool Img1TextD()
            {
                if (Environment.TickCount > (tc + 3000))
                {
                    return(true);
                }
                return(false);
            }

            //int tc = 0;


            void FadeUi1()
            {
            }

            void UI3()
            {
            }

            bool UI3D()
            {
                if (Environment.TickCount > (tc + 3500))
                {
                    return(true);
                }
                return(false);
            }

            void UI4S()
            {
                SUI.Root.Forms.Clear();

                var img1 = new ImageForm().Set(50, 50, 600, 600).SetImage(new Texture2D("Foom/Img/Intro/img3.jpg", LoadMethod.Single, false));
                var tex1 = new ImageForm().Set(100, 300, 600, 250).SetImage(new Texture2D("Foom/Img/Intro/text2.png", LoadMethod.Single, true));

                SUI.Root.Forms.Add(img1);
                SUI.Root.Add(img1);
                img1.Add(tex1);
                UI.TarAlpha = 1.0f;
            }

            bool FadeDone1()
            {
                if (Environment.TickCount > (tc + 3500))
                {
                    UI.TarAlpha = 0.0f;
                    if (UI.BootAlpha < 0.01f)
                    {
                        UI.TarAlpha = 1.0f;
                        return(true);
                    }
                }
                return(false);
            }

            void UI3S()
            {
                tc = Environment.TickCount;
                SUI.Root.Forms.Clear();

                var img2 = new ImageForm().Set(100, 100, 400, 400).SetImage(new Texture2D("Foom/Img/Intro/img2.jpg", LoadMethod.Single, true));

                SUI.Root.Add(img2);
                var log1 = new ImageForm().Set(220, 350, 500, 250).SetImage(new Texture2D("Foom/Img/Intro/text1.png", LoadMethod.Single, true));

                SUI.Root.Add(log1);
                Logics.When(FadeDone1, UI4S);

                UI.TarAlpha = 1.0f;
                Logics.Do(UI3, UI3D);
            }

            // bool UI3D()
            // {
            //    return false;
            //}


            bool FadeUID()
            {
                if (UI.BootAlpha < 0.01f)
                {
                    return(true);
                }
                return(false);
            }

            void FadeUI()
            {
                UI.TarAlpha = 0.0f;
                Logics.Do(FadeUi1, FadeUID, UI3S);
                //    UI.BootAlpha += (0.0f - UI.BootAlpha) * 0.1f;
            }

            void NextImg()
            {
                tc = Environment.TickCount;
                Logics.Do(Img1Text, Img1TextD, FadeUI);

                var text = new LabelForm().Set(600, 250, 200, 80, "The Dawn Of Hell...");

                SUI.Root.Forms.Add(text);
            }

            Logics.Do(ImgUp1, ImgUpR, NextImg);



            SUI = new UI();

            SUI.Root.Add(img);
        }
示例#17
0
 private void bPreview_Click(object sender, EventArgs e)
 {
   var imgfrm = new ImageForm(Previews[selectedIndex]);
   imgfrm.Text = (string) lbSelect.SelectedItem;
   imgfrm.ShowDialog();
 }
示例#18
0
        public static void Image(int x, int y, int w, int h, Texture2D img)
        {
            var tmp_img = new ImageForm().Set(x, y, w, h).SetImage(img);

            tmp_img.Draw();
        }
示例#19
0
        public override void Run()
        {
            var form = new AhpCaSetUpForm();

            form.ShowDialog();

            if (form.DialogResult != DialogResult.OK)
            {
            }
            else
            {
                // 初始化控制台
                this.consolePad = WorkbenchSingleton.Workbench.GetPad(typeof(ConsolePad)).PadContent.Control as GIS.Common.Dialogs.Console.Console;
                // 显示控制台
                WorkbenchSingleton.Workbench.GetPad(typeof(ConsolePad)).BringPadToFront();

                string        beginLayerName  = form.BeginLayerName; //"city2001_012"
                string        endLayerName    = form.EndLayerName;   //"city2006_012";
                List <string> driveLayerNames = form.DriveLayerNames;

                //= new List<string>()
                //{
                //    "distocity",
                //    "distohighway",
                //    "distorailway",
                //    "distoroad",
                //    "distotown"
                //};
                LandUseClassificationInfo landUseInfo = form.LandUseInfo;
                if (landUseInfo == null)
                {
                    landUseInfo          = new LandUseClassificationInfo();
                    landUseInfo.AllTypes = new List <StructLanduseInfo>()
                    {
                        new StructLanduseInfo()
                        {
                            LandUseTypeName = "城市", LandUseTypeValue = 1.0, LandUseTypeColor = Color.Black.ToArgb()
                        },
                        new StructLanduseInfo()
                        {
                            LandUseTypeName = "非城市", LandUseTypeValue = 0.0, LandUseTypeColor = Color.White.ToArgb()
                        },
                        new StructLanduseInfo()
                        {
                            LandUseTypeName = "水体", LandUseTypeValue = 2.0, LandUseTypeColor = Color.Blue.ToArgb()
                        },
                    };
                    landUseInfo.ConvertableInfos.Add(new StructLanduseInfo()
                    {
                        LandUseTypeName = "非城市", LandUseTypeValue = 0.0, LandUseTypeColor = Color.White.ToArgb()
                    });
                    landUseInfo.NullInfo = new StructLanduseInfo()
                    {
                        LandUseTypeName = "空值", LandUseTypeValue = -9999.0, LandUseTypeColor = Color.Transparent.ToArgb()
                    };
                    landUseInfo.UnConvertableInfos.Add(new StructLanduseInfo()
                    {
                        LandUseTypeName = "水体", LandUseTypeValue = 2.0, LandUseTypeColor = Color.Blue.ToArgb()
                    });
                    landUseInfo.UrbanInfos.Add(new StructLanduseInfo()
                    {
                        LandUseTypeName = "城市", LandUseTypeValue = 1.0, LandUseTypeColor = Color.Black.ToArgb()
                    });
                }

                float[] weights = form.Weights;
                if (weights == null)
                {
                    weights = new float[] { 0.35f, 0.13f, 0.13f, 0.13f, 0.25f };
                }
                int    sizeOfNeighbour = form.SizeOfNeighbour; //3;
                double globalFactor    = form.GlobalFactor;    //0.5;
                double localFactor     = form.LocalFactor;     //0.5;
                double alpha           = form.Alpha;           //1;
                int    countOfCity     = form.CountOfCity;     //200;

                var mce = new AhpCa(beginLayerName, endLayerName, driveLayerNames);
                mce.LandUseInfo         = landUseInfo;
                mce.Weights             = weights;
                mce.SizeOfNeighbour     = sizeOfNeighbour;
                mce.GlobalFactor        = globalFactor;
                mce.LocalFactor         = localFactor;
                mce.Alpha               = alpha;
                mce.CountOfCity         = countOfCity;
                mce.updateConsoleEvent += UpdateConsole;
                mce.updateImageEvent   += UpdateImage;

                this.imageForm = new ImageForm(mce.BeginBuffer, mce.Width, mce.Height, landUseInfo);
                this.imageForm.Show();

                Thread threadSimulate = new Thread(new ThreadStart(mce.simulate));
                threadSimulate.IsBackground = true;
                threadSimulate.Start();
            }
        }
示例#20
0
        /// <summary>
        /// Загрузка изображения
        /// </summary>
        protected override void Load()
        {
            UpdateTitle();
            if (scene == null)
            {
                // Создание сцены и камеры
                scene          = new Scene();
                cam            = new Camera();
                cam.Range      = new Vec2(-5, 10);
                cam.Zoom       = 6f;
                cam.Projection = Camera.ProjectionMode.Ortho;
                scene.Camera   = cam;
                zoom           = 6f;

                // Создание сетки
                grid          = new Entity();
                grid.Position = new Vec3(-0.5f, 0.5f, 9);
                grid.Angles   = new Vec3(-90, 0, 0);
                grid.AddComponent(new WireGridComponent()
                {
                    CellCount = 40,
                    CellSize  = 0.1f,
                    WireWidth = 0.5f
                });
                scene.Entities.Add(grid);
            }

            // Загрузка текстуры
            tex = new Texture(File.ProjectPath, Texture.LoadingMode.Instant);

            float mulX  = 1f / (float)tex.Width;
            float mulY  = 1f / (float)tex.Height;
            float mul   = mulX > mulY ? mulX : mulY;
            float halfX = (float)tex.Width * mul / 2f;
            float halfY = (float)tex.Height * mul / 2f;

            if (singleQuad == null)
            {
                singleQuad = new Entity();
                singleQuad.AddComponent(new MeshComponent());
                scene.Entities.Add(singleQuad);
            }
            MeshComponent singleMesh = singleQuad.GetComponent <MeshComponent>();

            singleMesh.Vertices = new Vec3[] {
                new Vec3(-halfX, halfY, 0),
                new Vec3(halfX, halfY, 0),
                new Vec3(-halfX, -halfY, 0),
                new Vec3(halfX, -halfY, 0),
            };
            singleMesh.TexCoords = new Vec2[] {
                new Vec2(0f, 0f),
                new Vec2(1f, 0f),
                new Vec2(0f, 1f),
                new Vec2(1f, 1f),
            };
            singleMesh.Indices = new ushort[] {
                0, 1, 2,
                1, 3, 2
            };
            singleMesh.Unlit   = true;
            singleMesh.Texture = tex;

            if (wrapQuad == null)
            {
                wrapQuad = new Entity();
                wrapQuad.AddComponent(new MeshComponent());
                scene.Entities.Add(wrapQuad);
            }
            MeshComponent wrapMesh = wrapQuad.GetComponent <MeshComponent>();

            wrapMesh.Vertices = new Vec3[] {
                new Vec3(-halfX * 3, halfY * 3, 0),
                new Vec3(halfX * 3, halfY * 3, 0),
                new Vec3(-halfX * 3, -halfY * 3, 0),
                new Vec3(halfX * 3, -halfY * 3, 0),
            };
            wrapMesh.TexCoords = new Vec2[] {
                new Vec2(-1f, -1f),
                new Vec2(2f, -1f),
                new Vec2(-1f, 2f),
                new Vec2(2f, 2f),
            };
            wrapMesh.Indices = new ushort[] {
                0, 1, 2,
                1, 3, 2
            };
            wrapMesh.Texture = tex;
            wrapMesh.Unlit   = true;
            wrapQuad.Visible = false;


            // Загрузка данных
            byte[] meta = File.Meta;
            if (meta != null)
            {
                BinaryReader f   = new BinaryReader(new MemoryStream(meta));
                ImageForm    frm = Form as ImageForm;

                frm.filteringCombo.SelectedIndex = f.ReadByte();
                frm.wrapUCombo.SelectedIndex     = f.ReadByte();
                frm.wrapVCombo.SelectedIndex     = f.ReadByte();
                frm.imageTileButton.Checked      = f.ReadBoolean();
                f.Close();
            }

            Saved = true;
        }
示例#21
0
        private void BuildUI(dynamic obj)
        {
            if (MapSet == null)
            {
                MapSet = new Texture2D("data/ui/mapset.png", LoadMethod.Single, false);
                NoMap  = new Texture2D("data/ui/nomap.png", LoadMethod.Single, false);
                Blank  = new Texture2D("data/ui/blank.jpg", LoadMethod.Single, false);
                CamPic = new Texture2D("data/ui/campic1.jpg", LoadMethod.Single, true);
            }
            Body.Forms.Clear();

            if (scroller == null)
            {
                scroller                 = new ScrollBarV().Set(Body.W - 10, 1, 10, Body.H) as ScrollBarV;
                scroller.ViewX           = GX;
                scroller.ViewY           = GY + 25;
                scroller.ViewW           = W;
                scroller.ViewH           = H - 35;
                scroller.ScrollBut.ViewX = GX;
                scroller.ScrollBut.ViewY = GY + 25;
                scroller.ScrollBut.ViewW = W;
                scroller.ScrollBut.ViewH = H - 35;
            }

            scroller.ValueChange = (v) =>
            {
                foreach (var f in Body.Forms)
                {
                    if (f == scroller)
                    {
                        continue;
                    }
                    f.OffY = (int)-scroller.Cur;
                    Console.WriteLine("sc:" + scroller.Cur);
                }
            };

            Body.Add(scroller);



            var lab = new LabelForm().Set(5, 10, 120, 25, "Class:" + obj.Name + " Type:" + obj.GetType().Name);

            Body.Add(lab);

            object t = obj as object;

            int py = 40;

            if (Obj is Vivid.Scripting.NodeScript)
            {
                var applyBut = new ButtonForm().Set(5, py, 80, 25, "Update") as ButtonForm;
                applyBut.Click = (b) =>
                {
                    Obj.ApplyInEditor();
                };

                Body.Add(applyBut);

                py += 35;
            }

            foreach (var prop in t.GetType().GetProperties())
            {
                var prop_lab = new LabelForm().Set(5, py, 80, 25, prop.Name);

                py += 30;

                var name = prop.PropertyType;
                //Console.WriteLine("Name:" + name.FullName);

                Console.WriteLine("Type:" + name.Name);

                var nn = name.Name;

                if (name.Name.Contains("List"))
                {
                    nn = "List";
                }

                if (prop.PropertyType.IsEnum)
                {
                    nn = "Enum";
                }



                bool use = false;
                switch (nn)
                {
                case "Enum":

                    var p_enum = prop.GetValue(Obj);



                    DropDownListForm list_f = new DropDownListForm().Set(5, py, 160, 25) as DropDownListForm;



                    foreach (var enum_name in prop.PropertyType.GetEnumNames())
                    {
                        list_f.AddItem(enum_name);
                    }

                    list_f.CurrentItem = p_enum.ToString();

                    list_f.SelectedItem = (item) =>
                    {
                        string ai = "";
                        int    ee = 0;
                        foreach (var enum_name in prop.PropertyType.GetEnumNames())
                        {
                            if (enum_name == item)
                            {
                                break;
                            }
                            ee++;
                        }
                        prop.SetValue(Obj, ee);
                    };

                    Body.Add(list_f);

                    py += 35;

                    use = true;
                    break;

                case "List":

                    var     p_list = prop.GetValue(Obj);
                    dynamic p_l    = p_list;
                    if (p_l != null)
                    {
                        foreach (dynamic litem in p_l)
                        {
                            var l_itemname = new TextBoxForm().Set(5, py, 180, 25, litem.GetName());
                            var l_edit     = new ButtonForm().Set(190, py, 60, 25, "Edit") as ButtonForm;
                            var l_remove   = new ButtonForm().Set(260, py, 80, 25, "Remove") as ButtonForm;


                            Body.Add(l_itemname);
                            Body.Add(l_remove);
                            Body.Add(l_edit);

                            l_edit.Click = (b) =>
                            {
                                SetObj(litem);
                            };

                            l_remove.Click = (b) =>
                            {
                                p_l.Remove(litem);
                                SetObj(Obj);
                            };


                            py += 35;
                        }
                    }

                    var l_dragzone = new DragZoneForm().Set(5, py, 180, 25) as DragZoneForm;

                    l_dragzone.DraggedObj = (o) =>
                    {
                        if (o.DragObj is ContentEntry)
                        {
                            var ce = o.DragObj as ContentEntry;
                            var le = ce.Load();
                            p_l.Add(le);
                            if (le is Vivid.Scripting.NodeScript)
                            {
                                le.Node = Obj;
                            }
                            SetObj(Obj);
                        }
                        ;
                    };
                    Body.Add(l_dragzone);

                    py += 35;

                    use = true;

                    break;

                case "Scripts":



                    var p_al = prop.GetValue(Obj) as System.Collections.Generic.List <Vivid.Scripting.NodeScript>;

                    foreach (var s in p_al)
                    {
                        var scr_name = new TextBoxForm().Set(5, py, 180, 25, s.GetType().Name);
                        var scr_edit = new ButtonForm().Set(190, py, 80, 25, "Edit") as ButtonForm;
                        py += 35;

                        Body.Add(scr_name);
                        Body.Add(scr_edit);

                        scr_edit.Click = (b) =>
                        {
                            SetObj(s);
                        };
                    }

                    use = true;
                    break;

                case "ClassLin4":



                    break;

                case "TextureCube":

                    var texc = prop.GetValue(Obj) as TextureCube;

                    var tc_name = new TextBoxForm().Set(5, py, 120, 25, "EnvMap");

                    Body.Add(tc_name);

                    py += 30;

                    Texture2D pi = null;

                    if (texc == null)
                    {
                        pi = NoMap;
                    }
                    else
                    {
                        pi = MapSet;
                    }
                    //     pi = Blank;

                    var texc_p = new ImageForm().Set(5, py, 128, 128, "").SetImage(pi) as ImageForm;

                    Body.Add(texc_p);

                    texc_p.CanDrop = true;
                    py            += 136;

                    texc_p.DraggedObj = (obj2) =>
                    {
                        var drago = obj2 as DragObject;
                        Console.WriteLine("Prev!");
                        if (drago.DragObj is ContentEntry)
                        {
                            var ce   = drago.DragObj as ContentEntry;
                            var ntex = new TextureCube(ce.FullPath);
                            //Console.WriteLine("Setting Content");
                            try
                            {
                                prop.SetValue(Obj, ntex);
                                SetObj(Obj);
                            }
                            catch
                            {
                            }
                        }
                    };

                    use = true;

                    break;

                case "Tex2D":
                    var tex = prop.GetValue(Obj) as Vivid.Tex.Tex2D;

                    if (tex == null)
                    {
                        prop.SetValue(Obj, WhiteTex2D);
                        tex = WhiteTex2D;
                    }

                    var t_name = new TextBoxForm().Set(5, py, 120, 25, tex.Name);

                    Body.Add(t_name);

                    py += 30;

                    var m_prev = new ImageForm().Set(5, py, 128, 128, "").SetImage(tex.ToTexture2D()) as ImageForm;

                    var set_image = new ButtonForm().Set(140, py, 80, 25, "Set Image") as ButtonForm;

                    Body.Add(set_image);

                    set_image.Click = (b) =>
                    {
                        var sir = new RequestFileForm("Select image..", GameGlobal.ContentPath);

                        UI.CurUI.Top = sir;

                        sir.Selected = (path) =>
                        {
                            UI.CurUI.Top = null;
                            prop.SetValue(Obj, new Vivid.Tex.Tex2D(path, true));
                            SetObj(Obj);
                        };
                    };

                    py += 136;

                    //var nm_name = new TextBoxForm().Set(5,py,120,25,N)

                    m_prev.DraggedObj = (o) =>
                    {
                        var drago = o as DragObject;
                        Console.WriteLine("Prev!");
                        if (drago.DragObj is ContentEntry)
                        {
                            var ce   = drago.DragObj as ContentEntry;
                            var ntex = new Texture2D(ce.FullPath, LoadMethod.Single, true);
                            //Console.WriteLine("Setting Content");
                            try
                            {
                                prop.SetValue(Obj, ntex.ToTex2D());
                                SetObj(Obj);
                            }
                            catch
                            {
                            }
                        }
                    };

                    m_prev.CanDrop = true;

                    Body.Add(m_prev);

                    use = true;

                    break;

                case "Texture2D":

                    var tex2 = prop.GetValue(Obj) as Texture2D;

                    if (tex2 == null)
                    {
                        prop.SetValue(Obj, WhiteTex);
                        tex2 = WhiteTex;
                    }

                    var t_name2 = new TextBoxForm().Set(5, py, 120, 25, tex2.Name);

                    Body.Add(t_name2);

                    py += 30;

                    var m_prev2 = new ImageForm().Set(5, py, 128, 128, "").SetImage(tex2) as ImageForm;


                    py += 136;

                    //var nm_name = new TextBoxForm().Set(5,py,120,25,N)

                    m_prev2.DraggedObj = (o) =>
                    {
                        var drago = o as DragObject;
                        Console.WriteLine("Prev!");
                        if (drago.DragObj is ContentEntry)
                        {
                            var ce   = drago.DragObj as ContentEntry;
                            var ntex = new Texture2D(ce.FullPath, LoadMethod.Single, true);
                            //Console.WriteLine("Setting Content");
                            try
                            {
                                prop.SetValue(Obj, ntex);
                                SetObj(Obj);
                            }
                            catch
                            {
                            }
                        }
                    };

                    m_prev2.CanDrop = true;

                    Body.Add(m_prev2);

                    use = true;

                    break;

                case "ScriptList":

                    var sl = prop.GetValue(Obj) as Vivid.Script.ScriptList;

                    use = true;

                    int num = 0;
                    foreach (var ns in sl.Scripts)
                    {
                        var scr_name_lab = new TextBoxForm().Set(5, py, 240, 25, "Script" + num + ":" + ns.Name);
                        Body.Add(scr_name_lab);
                        num++;
                        py += 30;
                    }

                    break;

                case "Material3D":

                    var mat = prop.GetValue(Obj) as Vivid.Material.Material3D;

                    var m_name = new TextBoxForm().Set(5, py, 120, 25, mat.Name);

                    var m_edit = new ButtonForm().Set(130, py, 60, 25, "Edit");

                    m_edit.Click = (b) =>
                    {
                        SetObj(mat);
                    };

                    Body.Add(m_name);
                    Body.Add(m_edit);
                    py += 30;
                    use = true;

                    break;

                case "string":
                case "String":

                    var str = prop.GetValue(Obj) as string;
                    if (str == null)
                    {
                        str = "";
                    }
                    var str_box = new TextBoxForm().Set(5, py, 220, 25, str) as TextBoxForm;

                    str_box.Enter = (txt) =>
                    {
                        prop.SetValue(Obj, str_box.Text);
                    };

                    //Console.WriteLine("TB==" + str + "!");

                    if (prop.Name.Contains("Path"))
                    {
                        var path_sel = new ButtonForm().Set(230, py, 60, 25, "Select");
                        Body.Add(path_sel);


                        path_sel.Click = (b) =>
                        {
                            var path_r = new RequestFileForm("Select file...");
                            UI.CurUI.Top    = path_r;
                            path_r.Selected = (path) =>
                            {
                                prop.SetValue(Obj, path);
                                UI.CurUI.Top = null;
                                SetObj(Obj);
                            };
                        };
                    }

                    Body.Add(str_box);
                    use = true;
                    py += 30;

                    break;

                case "ClassLis4":
                    use = true;


                    break;

                case "Int32":
                    use = true;
                    //while (true)
                    //{
                    //}

                    var ival = prop.GetValue(Obj);

                    var i_lab = new LabelForm().Set(5, py, 25, 25, "Val");
                    var i_box = new TextBoxForm().Set(50, py, 75, 25, ival.ToString()) as TextBoxForm;

                    i_box.Enter = (n44) =>
                    {
                        try
                        {
                            ival = int.Parse(n44);
                            prop.SetValue(Obj, ival);
                        }
                        catch
                        {
                            ival = 0;
                        }

                        try
                        {
                            Obj.Changed();
                        }
                        catch
                        {
                        }
                    };

                    Body.Add(i_lab, i_box);

                    py += 30;

                    break;

                case "Single":

                    use = true;
                    //while (true)
                    //{
                    //}

                    var fval = prop.GetValue(Obj);

                    var v_lab = new LabelForm().Set(5, py, 25, 25, "Val");
                    var v_box = new TextBoxForm().Set(50, py, 75, 25, fval.ToString()) as TextBoxForm;

                    v_box.Enter = (n44) =>
                    {
                        try
                        {
                            fval = float.Parse(n44);
                            prop.SetValue(Obj, fval);
                        }
                        catch
                        {
                            fval = 0;
                        }

                        try
                        {
                            Obj.Changed();
                        }
                        catch
                        {
                        }
                    };

                    Body.Add(v_lab, v_box);

                    py += 30;

                    //  v_box.Enter = (sval) =>

                    //       fval = float.Parse(sval);/

                    break;


                case "Vector3":
                    use = true;

                    var vec3 = prop.GetValue(Obj);

                    var x_lab = new LabelForm().Set(5, py, 25, 25, "X") as LabelForm;
                    var y_lab = new LabelForm().Set(110, py, 25, 25, "Y");
                    var z_lab = new LabelForm().Set(215, py, 25, 25, "Z");

                    var x_box = new TextBoxForm().Set(30, py, 75, 25, vec3.X.ToString()) as TextBoxForm;
                    var y_box = new TextBoxForm().Set(135, py, 75, 25, vec3.Y.ToString()) as TextBoxForm;
                    var z_box = new TextBoxForm().Set(240, py, 75, 25, vec3.Z.ToString()) as TextBoxForm;

                    x_box.Enter = (val) =>
                    {
                        try
                        {
                            vec3.X = float.Parse(val);
                        }
                        catch
                        {
                        }
                        prop.SetValue(Obj, vec3);
                        try
                        {
                            Obj.Changed();
                        }
                        catch
                        {
                        }
                    };

                    y_box.Enter = (val) =>
                    {
                        try
                        {
                            vec3.Y = float.Parse(val);
                        }
                        catch
                        {
                        }
                        prop.SetValue(Obj, vec3);
                        try
                        {
                            Obj.Changed();
                        }
                        catch
                        {
                        }
                    };

                    z_box.Enter = (val) =>
                    {
                        try
                        {
                            vec3.Z = float.Parse(val);
                        }
                        catch
                        {
                        }
                        prop.SetValue(Obj, vec3);
                        try
                        {
                            Obj.Changed();
                        }
                        catch
                        {
                        }
                    };

                    Body.Add(x_lab, y_lab, z_lab);
                    Body.Add(x_box, y_box, z_box);

                    py += 30;

                    break;
                }
                if (use)
                {
                    var prop_type = new LabelForm().Set(5, py, 80, 25, name.Name);

                    Body.Add(prop_lab);
                    //  body.Add(prop_type);

                    //py += 30;
                }
                else
                {
                    py -= 30;
                }
            }
            scroller.SetMax(py);
        }
示例#22
0
 public void CloseWindow(ImageForm img)
 {
     // Program Close Its popsup
     PROGRAM.CloseWindow(this);
 }
示例#23
0
 public void SetActiveImageForm(ImageForm imageForm)
 {
     this.activeImageForm = imageForm;
 }