Exemplo n.º 1
0
        public CustomizeMapForm()
        {
            InitializeComponent();

            //init toolbars

            mapControl.InitBufZonesToolBar();
            mapControl.InitMapProjectToolBar();

            ////add SaveMap Tool to Project panel
            //var mbb = new MapBarButton();
            //var mTool = new MtSaveMap { MapImage = mapControl.m_mapImage };
            //mbb.MapTool = mTool;
            //mapControl.barManager.Bars["MapProjects"].AddItem(mbb);


            //TODO[enikulin]: add user rights

            //Debug! Profile map load
            mapControl.m_mapImage.MapRefreshed += m_mapImage_MapRefreshed;
            mapControl.m_mapImage.SizeChanged  += m_mapImage_SizeChanged;
            //IApplicationForm initialization
            Sizable     = true;
            HelpTopicId = "MapsConfiguration";
            Text        = EidssMessages.GetForCurrentLang("gis_Form_NewMapProject_Text", "New Map Project");;

            FormClosing += CustomizeMapForm_FormClosing;
        }
Exemplo n.º 2
0
        protected override void OnClick()
        {
            var strTitle         = EidssMessages.GetForCurrentLang("gis_Caption_SaveOpenMpk", "Select map pack");
            var strFilter        = EidssMessages.GetForCurrentLang("gis_FilterMpk", "Map pack files | *.mpk");
            var strError         = EidssMessages.GetForCurrentLang("gis_OpenMpkError", "Map can't be imported!");
            var strComplete      = EidssMessages.GetForCurrentLang("gis_OpenMpkComplete", "Map has been successfully imported!");
            var strCompleteTitle = EidssMessages.GetForCurrentLang("gis_MpkCompleteTitle", "EIDDS Maps");


            var openFileDialog = new OpenFileDialog {
                Title = strTitle, Filter = strFilter
            };

            if (openFileDialog.ShowDialog(null) == DialogResult.OK)
            {
                try
                {
                    var outPath = Path.Combine(MapProjectsStorage.CustomProjectsPath);
                    MapPacker.UnpackMap(openFileDialog.FileName, outPath, selectNewName);
                    MapProjectsStorage.UpdateMapProjectList();
                    MessageForm.Show(strComplete, strCompleteTitle, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                catch (Exception ex)
                {
                    ErrorForm.ShowError(strError, ex);
                }
            }
        }
Exemplo n.º 3
0
 void CustomizeMapForm_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (GetMapProjectState() == MapUtils.MapProjectState.Unsaved)
     {
         var text = EidssMessages.GetForCurrentLang("gis_CustomForm_SaveChangesRequest",
                                                    "Would you like to save changes before closing this form?");
         var dr = MessageForm.Show(text, "Save", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
         if (dr == DialogResult.Yes)
         {
             SaveMapProject(false);
         }
         else if (dr == DialogResult.No)
         {
             e.Cancel = false;
         }
         else
         {
             e.Cancel = true;
         }
     }
     else
     {
         e.Cancel = false;
     }
 }
Exemplo n.º 4
0
        private void CreateNewProject(CustomizeMapForm mapForm)
        {
            mapForm.Text = EidssMessages.GetForCurrentLang("gis_Form_NewMapProject_Text", "New Map Project");;
            var mapFileName = MapProjectsStorage.DefaultMapPath;

            mapForm.mapControl.LoadMap(mapFileName);
            mapForm.m_BeforeFirstSaving = true;
            mapForm.UpdateMapStateXml();
            mapForm.mapControl.m_mapImage.Refresh();
        }
Exemplo n.º 5
0
        public MtNewMap()
        {
            Bitmap temp = Resources.new_icon;

            temp.MakeTransparent();
            m_Image = temp;

            m_Caption     = EidssMessages.GetForCurrentLang("gis_Tools_NewMapProject_Caption", "New Map Project"); //"New Map Project"; //Resources.gis_MtSaveMap_Caption;
            m_ToolTipText = EidssMessages.GetForCurrentLang("gis_Tools_NewMapProject_Text", "New Map Project");    //"New Map Project"; //Resources.gis_MtSaveMap_ToolTipText;
        }
Exemplo n.º 6
0
        public MtSaveMapAs()
        {
            Bitmap temp = Resources.save_as_icon;

            temp.MakeTransparent();
            m_Image = temp;

            m_Caption     = EidssMessages.GetForCurrentLang("gis_Tools_SaveMapProjectAs_Caption", "Save Map Project As");
            m_ToolTipText = EidssMessages.GetForCurrentLang("gis_Tools_SaveMapProjectAs_Text", "Save Map Project As");

            //m_Caption = "Save Map Project As"; //Resources.gis_MtSaveMap_Caption;
            //m_ToolTipText = "Save Map Project As"; //Resources.gis_MtSaveMap_ToolTipText;
        }
Exemplo n.º 7
0
 void Instance_LayerDeserializationExceptionEvent(string layerName, string type, Exception ex)
 {
     lock (lockObj)
     {
         if (!m_ErrorFormShowed)
         {
             m_ErrorFormShowed = true;
             var message = EidssMessages.GetForCurrentLang("gis_LayerCantBeLoaded",
                                                           "One or more layers can't be loaded!");
             //ErrorForm.ShowError(message, ex); //TODO [enikulin]: NEED REQURES!
         }
     }
 }
Exemplo n.º 8
0
        public MtAdminMask()
        {
            Bitmap temp = Resources.filter_icon;

            temp.MakeTransparent();
            m_Image = temp;

            m_Caption     = EidssMessages.GetForCurrentLang("gis_Tools_AdministrationUnitMask_Caption", "Administration Unit Mask");
            m_ToolTipText = EidssMessages.GetForCurrentLang("gis_Tools_AdministrationUnitMask_Text", "Administration Unit Mask");

            //m_Caption = "Administration Unit Mask"; //Resources.gis_MtSaveMap_Caption;
            //m_ToolTipText = "Administration Unit Mask"; //Resources.gis_MtSaveMap_ToolTipText;
        }
Exemplo n.º 9
0
        private void DeleteSelected()
        {
            var msg     = EidssMessages.GetForCurrentLang("gis_Message_DelZone", "Would you like to delete selected buffer zone?");
            var caption = EidssMessages.GetForCurrentLang("gis_Caption_DelZone", "Delete buffer zone");

            if (MessageForm.Show(msg, caption, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                if (m_SelectedFeature != null)
                {
                    //MapImage.Cursor = Cursors.WaitCursor;
                    if (!m_IsMoveMode)
                    {
                        ((EidssUserBufZoneLayer)UserDbLayersManager.GetUserLayer(m_TargetLayerGuid)).DeleteZone(
                            (long)m_SelectedFeature["idfsGeoObject"]);
                    }
                    else
                    {
                        ((EidssUserBufZoneLayer)UserDbLayersManager.GetUserLayer(m_LastMovedTargetLayerGuid)).DeleteZone(
                            (long)m_SelectedFeature["idfsGeoObject"]);
                    }

                    m_SelectedFeature = null;

                    if (m_IsMoveMode)
                    {
                        m_MiApplyMovement.Visible  = false;
                        m_MiCancelMovement.Visible = false;
                        m_MiMove.Visible           = true;
                    }

                    if (UserDbLayersManager.GetLayerMetadata(m_TargetLayerGuid).m_PivotalLayer != PivotLayerType.None)
                    {
                        m_MiMove.Visible = false;
                    }

                    m_IsMoveMode = false;
                    m_MapImage.CommandToolPress -= m_MapImage_CommandToolPress;

                    //MapImage.Cursor = Cursors.Default;
                    MapImage.Refresh();
                }
            }
        }
Exemplo n.º 10
0
 protected override void OnClick()
 {
     // set map project state to New condition
     if (MapImage != null)
     {
         var mapControl = MapImage.Parent;
         if (mapControl != null)
         {
             var mapForm = mapControl.Parent;
             if (mapForm != null & mapForm is CustomizeMapForm)
             {
                 if (((CustomizeMapForm)mapForm).GetMapProjectState() == MapUtils.MapProjectState.Unsaved)
                 {
                     var msg = EidssMessages.GetForCurrentLang("gis_Form_NewMapProject_SaveMsg", "Would you like to save changes of the current Map Project?");
                     //"Would you like to save changes of the current Map Project?";
                     var caption = "";
                     var dr      = MessageForm.Show(msg, caption, MessageBoxButtons.YesNoCancel,
                                                    MessageBoxIcon.Question);
                     if (dr == DialogResult.Yes)
                     {
                         if (((CustomizeMapForm)mapForm).SaveMapProject(false))
                         {
                             // create new
                             CreateNewProject((CustomizeMapForm)mapForm);
                         }
                     }
                     else if (dr == DialogResult.No)
                     {
                         CreateNewProject((CustomizeMapForm)mapForm);
                     }
                 }
                 else
                 {
                     // create new
                     CreateNewProject((CustomizeMapForm)mapForm);
                 }
             }
         }
     }
 }
Exemplo n.º 11
0
        protected override void OnClick()
        {
            if (ZipConstants.DefaultCodePage == 1)
            {
                ZipConstants.DefaultCodePage = 437; //bug in OEMCodePage property TODO[enikulin]: is it need?
            }
            var strTitle         = EidssMessages.GetForCurrentLang("gis_Caption_SaveOpenMpk", "Select map pack");
            var strFilter        = EidssMessages.GetForCurrentLang("gis_FilterMpk", "Map pack files | *.mpk");
            var strError         = EidssMessages.GetForCurrentLang("gis_SaveMpkError", "Map can't be saved!");
            var strComplete      = EidssMessages.GetForCurrentLang("gis_SaveMpkComplete", "Map has been successfully exporting!");
            var strCompleteTitle = EidssMessages.GetForCurrentLang("gis_MpkCompleteTitle", "EIDDS Maps");


            var saveFileDialog = new SaveFileDialog {
                Title = strTitle, OverwritePrompt = true, Filter = strFilter
            };

            if (saveFileDialog.ShowDialog(null) == DialogResult.OK)
            {
                try
                {
                    var map      = m_MapImage.Map;
                    var settings = m_MapImage.MapSettings;
                    using (new TemporaryWaitCursor())
                    {
                        MapPacker.PackMap(map, settings, Path.GetFileNameWithoutExtension(saveFileDialog.FileName),
                                          saveFileDialog.FileName);
                    }
                    MessageForm.Show(strComplete, strCompleteTitle, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                catch (Exception ex)
                {
                    //TODO[enikulin]: Change this code!
                    //(new EIDSSErrorMessage("errCantSaveMap", strError, ex)
                    ErrorForm.ShowError(strError, ex);
                }
            }
        }
Exemplo n.º 12
0
        internal static string TranslateLayerName(string layerName)
        {
            switch (layerName)
            {
            case SystemLayerNames.Countries:
                return(EidssMessages.GetForCurrentLang("gis_LayerNames_Country", "Countries"));

            case SystemLayerNames.Regions:
                return(EidssMessages.GetForCurrentLang("gis_LayerNames_Regions", "Regions"));

            case SystemLayerNames.Rayons:
                return(EidssMessages.GetForCurrentLang("gis_LayerNames_Rayons", "Rayons"));

            case SystemLayerNames.Settlements:
                return(EidssMessages.GetForCurrentLang("gis_LayerNames_Settlements", "Settlements"));

            case "gisWKBEarthRoad":
                return(EidssMessages.GetForCurrentLang("gis_LayerNames_EarthRoad", "Earth roads"));

            case "gisWKBHighway":
                return(EidssMessages.GetForCurrentLang("gis_LayerNames_Highway", "Highways"));

            case "gisWKBInlandWater":
                return(EidssMessages.GetForCurrentLang("gis_LayerNames_InlandWater", "Inland water"));

            case "gisWKBLake":
                return(EidssMessages.GetForCurrentLang("gis_LayerNames_Lake", "Lakes"));

            case "gisWKBMainRiver":
                return(EidssMessages.GetForCurrentLang("gis_LayerNames_MainRiver", "Main rivers"));

            case "gisWKBMajorRoad":
                return(EidssMessages.GetForCurrentLang("gis_LayerNames_MajorRoad", "Major roads"));

            case "gisWKBRailroad":
                return(EidssMessages.GetForCurrentLang("gis_LayerNames_Railroad", "Railroads"));

            case "gisWKBRiver":
                return(EidssMessages.GetForCurrentLang("gis_LayerNames_River", "Rivers"));

            case "gisWKBSea":
                return(EidssMessages.GetForCurrentLang("gis_LayerNames_Sea", "Sea"));

            case "gisWKBSmallRiver":
                return(EidssMessages.GetForCurrentLang("gis_LayerNames_SmallRiver", "Small rivers"));

            case "gisWKBForest":
                return(EidssMessages.GetForCurrentLang("gis_LayerNames_Forest", "Forests"));

            case "gisWKBLanduse":
                return(EidssMessages.GetForCurrentLang("gis_LayerNames_Landuse", "Land use"));

            case "gisWKBRuralDistrict":
                return(EidssMessages.GetForCurrentLang("gis_LayerNames_RuralDistrict", "Rural districts"));

            case "gisWKBDistrict":
                return(EidssMessages.GetForCurrentLang("gis_LayerNames_District", "Districts"));



            default:
                return(layerName);
            }
        }
Exemplo n.º 13
0
        void m_MapSelectBarItem_EditValueChanged(object sender, EventArgs e)
        {
            if (m_SelfRefresh)
            {
                return;
            }

            var cea = new CancelEventArgs();

            OnMapChanging(cea);
            if (cea.Cancel)
            {
                m_MapSelectBarItem.EditValueChanged -= m_MapSelectBarItem_EditValueChanged;
                m_MapSelectBarItem.EditValue         = m_OldMapName;
                m_MapSelectBarItem.EditValueChanged += m_MapSelectBarItem_EditValueChanged;
                return;
            }

            if (m_MapControl != null && m_MapControl.Map != null && m_MapControl.Image != null)
            {
                var selectedValue = m_MapSelectBarItem.EditValue as String;

                string mapFileName;

                if (selectedValue == MapProjectsStorage.DefaultMapName)
                {
                    mapFileName = MapProjectsStorage.DefaultMapPath;
                }
                else
                {
                    mapFileName = MapProjectsStorage.GetMapFullPath(MapProjectsStorage.CustomProjectsPath, selectedValue);
                }


                var msg     = EidssMessages.GetForCurrentLang("gis_Message_OpenMap", "Would you like to open this map?");
                var caption = EidssMessages.GetForCurrentLang("gis_Caption_OpenMap", "Open map: ");
                var errMsg  = EidssMessages.GetForCurrentLang("gis_ErrMessage_OpenMap", "Can't open selected map.");

                if (MessageForm.Show(msg, caption + selectedValue, MessageBoxButtons.YesNo,
                                     MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    var extent = m_MapControl.Map.Envelope.Clone();

                    try
                    {
                        //check AVR layers and store it for future use

                        if (m_MapControl.Parent is AvrMapControl)
                        {
                            //EventLayer eventLayer = null;
                            LayerGroup eventGroup = null;

                            //foreach (var layer in m_MapControl.Map.Layers)
                            //{
                            //    if (!(layer is EventLayer)) continue;
                            //    eventLayer = (EventLayer) layer;
                            //    break;
                            //}

                            foreach (LayerGroup layer in m_MapControl.Map.Layers.OfType <LayerGroup>())
                            {
                                eventGroup = layer;
                                if (eventGroup.Tag.ToString() != "eventgroup")
                                {
                                    continue;
                                }

                                eventGroup = layer;
                                break;
                            }
                            var pos = m_MapControl.Map.Layers.IndexOf(eventGroup);
                            (m_MapControl.Parent as EidssMapControl).LoadMap(mapFileName);
                            if (eventGroup != null)
                            {
                                m_MapControl.Map.Layers.Insert(pos, eventGroup);
                            }

                            ((AvrMapControl)(m_MapControl.Parent)).UseDynamicData();
                            Content.RefreshMapContent();
                        }
                        else
                        {
                            (m_MapControl.Parent as EidssMapControl).LoadMap(mapFileName);
                        }

                        m_OldMapName = selectedValue;
                    }
                    catch (Exception ex)
                    {
                        ErrorForm.ShowErrorDirect(errMsg, ex);
                        //return old value
                        m_SelfRefresh = true;
                        m_MapSelectBarItem.EditValue = m_OldMapName;
                        m_SelfRefresh = false;
                        return;
                    }

                    m_MapControl.Map.ZoomToBox(extent);

                    m_MapControl.Refresh();

                    //deactivate all edit tools
                    if ((m_MapControl.Parent as MapControl).DefaultTool is ControllerMapTool)
                    {
                        ((m_MapControl.Parent as MapControl).DefaultTool as ControllerMapTool).IsActive = true;
                    }
                }
                else
                {
                    //return old value
                    m_SelfRefresh = true;
                    m_MapSelectBarItem.EditValue = m_OldMapName;
                    m_SelfRefresh = false;
                }
            }
        }
Exemplo n.º 14
0
        public bool Search()
        {
            var value = m_SearchString;

            if (value == string.Empty)
            {
                return(false);
            }

            SearchResultList = new List <SearchItem>();

            try
            {
                var strConnect    = ConnectionManager.DefaultInstance.ConnectionString;
                var sqlConnection = new SqlConnection(strConnect);

                sqlConnection.Open();

                int objNum = 0;

                #region Search in Regions

                var sql =
                    string.Format(
                        @"WITH [RegSearchOrder] AS (SELECT ROW_NUMBER() OVER (ORDER BY [strTextString]) AS [rownum],
                                [idfsGISBaseReference],
                                [strTextString], 
                                [gisWKBRegion].[geomShape].STAsBinary() AS [Shape]
                          FROM [gisStringNameTranslation] 
                          INNER JOIN [gisRegion] ON [gisStringNameTranslation].[idfsGISBaseReference]=[gisRegion].[idfsRegion]
                            INNER JOIN [gisWKBRegion] ON [gisStringNameTranslation].[idfsGISBaseReference]=[gisWKBRegion].[idfsGeoObject]   
                          WHERE [strTextString] LIKE N'%{0}%') SELECT [idfsGISBaseReference], [strTextString], [Shape] FROM [RegSearchOrder] WHERE [rownum] BETWEEN {1} AND {2}",
                        value, m_SearchRegNum + 1, m_SearchRegNum + GeoObjPerPage);

                var sqlCommand1    = new SqlCommand(sql, sqlConnection);
                var sqlDataReader1 = sqlCommand1.ExecuteReader();
                while (sqlDataReader1.Read())
                {
                    var geom =
                        SharpMap.Converters.WellKnownBinary.GeometryFromWKB.Parse((byte[])sqlDataReader1[2]);
                    SearchResultList.Add(new SearchItem(sqlDataReader1[1].ToString(), string.Empty, string.Empty,
                                                        long.Parse(sqlDataReader1[0].ToString()), geom));
                    objNum++;
                    m_SearchRegNum++;
                }

                #endregion

                if (objNum < GeoObjPerPage)
                {
                    #region Search in Rayons

                    sql = string.Format(@"WITH [RnSearchOrder] AS
                                        (
	                                        SELECT ROW_NUMBER() OVER (ORDER BY [gisStringNameTranslation].[strTextString]) AS [rownum],
                                                   [gisStringNameTranslation].[idfsGISBaseReference], 
                                                   [gisStringNameTranslation].[idfsLanguage],
                                                   [gisStringNameTranslation].[strTextString], 
                                                   [gisRayon].idfsRegion, 
                                                   [trans].[strTextString] AS [regName],
                                                   [gisWKBRayon].[geomShape].STAsBinary() AS [Shape]
	                                        FROM [gisStringNameTranslation]
		                                    INNER JOIN [gisRayon] ON [gisStringNameTranslation].[idfsGISBaseReference]=[gisRayon].[idfsRayon]	
			                                    INNER JOIN [gisStringNameTranslation] AS [trans] ON [trans].[idfsGISBaseReference]=[gisRayon].[idfsRegion]
                                                    INNER JOIN [gisWKBRayon] ON [gisStringNameTranslation].[idfsGISBaseReference]=[gisWKBRayon].[idfsGeoObject]		
	                                        WHERE [gisStringNameTranslation].[strTextString] LIKE N'%{0}%' 
                                                  AND [gisStringNameTranslation].[idfsLanguage]=[trans].[idfsLanguage]
                                        )
                                        SELECT [RnSearchOrder].[idfsGISBaseReference],
                                               [RnSearchOrder].[idfsLanguage], 
                                               [RnSearchOrder].[strTextString], 
                                               [idfsRegion], 
                                               [regName], 
                                               [Shape]
                                        FROM [RnSearchOrder]    
                                        WHERE [rownum] BETWEEN {1} AND {2}", value, m_SearchRnNum + 1,
                                        m_SearchRnNum + GeoObjPerPage - objNum);

                    objNum = 0;
                    var sqlCommand2    = new SqlCommand(sql, sqlConnection);
                    var sqlDataReader2 = sqlCommand2.ExecuteReader();
                    while (sqlDataReader2.Read())
                    {
                        var geom = SharpMap.Converters.WellKnownBinary.GeometryFromWKB.Parse((byte[])sqlDataReader2[5]);
                        SearchResultList.Add(new SearchItem(sqlDataReader2[4].ToString(), sqlDataReader2[2].ToString(),
                                                            string.Empty, long.Parse(sqlDataReader2[0].ToString()), geom));
                        objNum++;
                        m_SearchRnNum++;
                    }
                    #endregion

                    #region Search in settlements

                    sql = string.Format(@"WITH [StSearchOrder] AS
                                        (
	                                        SELECT ROW_NUMBER() OVER (ORDER BY [gisStringNameTranslation].[strTextString]) AS [rownum],
		                                           [gisStringNameTranslation].[idfsGISBaseReference],
                                                   [gisStringNameTranslation].[idfsLanguage],
		                                           [gisStringNameTranslation].[strTextString],
		                                           [gisSettlement].[idfsSettlement],           
		                                           [trans].[strTextString] AS [rnName],
		                                           [trans1].[strTextString] AS [regName],
                                                   [gisWKBSettlement].[geomShape].STAsBinary() AS [Shape]
	                                        FROM [gisStringNameTranslation]
		                                    INNER JOIN [gisSettlement] ON [gisStringNameTranslation].idfsGISBaseReference=[gisSettlement].[idfsSettlement]
			                                    INNER JOIN [gisStringNameTranslation] AS [trans] ON [trans].[idfsGISBaseReference]=[gisSettlement].[idfsRayon]		
				                                    INNER JOIN [gisStringNameTranslation] AS [trans1] ON [trans1].[idfsGISBaseReference]=[gisSettlement].[idfsRegion]
                                                        INNER JOIN [gisWKBSettlement] ON [gisStringNameTranslation].[idfsGISBaseReference]=[gisWKBSettlement].[idfsGeoObject]										
	                                        WHERE [gisStringNameTranslation].[strTextString] LIKE N'%{0}%' 
	                                                AND [gisStringNameTranslation].[idfsLanguage]=[trans].[idfsLanguage]
	                                                AND [gisStringNameTranslation].[idfsLanguage]=[trans1].[idfsLanguage]
                                        )
                                        SELECT [StSearchOrder].[idfsGISBaseReference],
                                               [StSearchOrder].[idfsLanguage], 
                                               [StSearchOrder].[strTextString], 
                                               [rnName], 
                                               [regName], 
                                               [Shape]
                                        FROM [StSearchOrder]    
                                        WHERE [rownum] BETWEEN {1} AND {2}", value, m_SearchStNum + 1,
                                        m_SearchStNum + GeoObjPerPage - objNum);
                    objNum = 0;
                    var sqlCommand3    = new SqlCommand(sql, sqlConnection);
                    var sqlDataReader3 = sqlCommand3.ExecuteReader();
                    while (sqlDataReader3.Read())
                    {
                        var geom = SharpMap.Converters.WellKnownBinary.GeometryFromWKB.Parse((byte[])sqlDataReader3[5]);
                        SearchResultList.Add(new SearchItem(sqlDataReader3[4].ToString(), sqlDataReader3[3].ToString(),
                                                            sqlDataReader3[2].ToString(),
                                                            long.Parse(sqlDataReader3[0].ToString()), geom));
                        objNum++;
                        m_SearchStNum++;
                    }
                    #endregion
                }

                sqlConnection.Close();

                if (SearchResultList.Count == 0)
                {
                    return(false);
                }

                if (m_SearchResultPanel == null)
                {
                    if (!RtlHelper.IsRtl)
                    {
                        m_SearchResultPanel = m_DockManager.AddPanel(DockingStyle.Left);
                    }
                    else
                    {
                        m_SearchResultPanel = m_DockManager.AddPanel(DockingStyle.Right);
                    }
                    //m_SearchResultPanel.Visible = false;
                    m_SearchResultPanel.Text = EidssMessages.GetForCurrentLang("gis_Tools_Geosearch_Btn", "Search");
                    m_DockManager.DockingOptions.ShowAutoHideButton = false;
                    m_SearchResult = new SearchResult(this);
                    m_SearchResultPanel.Controls.Add(m_SearchResult);
                    m_SearchResult.Dock = DockStyle.Fill;

                    m_SearchResultPanel.ClosingPanel += m_SearchResultPanel_ClosingPanel;
                }

                m_SearchResult.RefreshList();
            }
            catch (Exception ex)
            {
                throw new Exception("Search error: " + ex.Message);
            }

            return(true);
        }
Exemplo n.º 15
0
        public void InitLightMapProjectToolBar()
        {
            barManager.Form = this;
            barManager.BeginUpdate();


            #region Create GeoSearch bar

            var geoSearchBar = new Bar(barManager, "GeoSearch");
            geoSearchBar.OptionsBar.AllowDelete             = false;
            geoSearchBar.OptionsBar.AllowQuickCustomization = false;
            geoSearchBar.OptionsBar.DisableClose            = true;
            geoSearchBar.OptionsBar.DisableCustomization    = true;
            geoSearchBar.DockStyle           = BarDockStyle.Top;
            geoSearchBar.CanDockStyle        = BarCanDockStyle.Top;
            geoSearchBar.OptionsBar.BarState = BarState.Expanded;
            geoSearchBar.Visible             = true;
            geoSearchBar.DockRow             = 0;
            geoSearchBar.DockCol             = 3;
            geoSearchBar.ApplyDockRowCol();

            //create MapSelectorTool
            var beGeoSearch = new RepositoryItemButtonEdit();
            //beGeoSearch.Buttons[0].ToolTip = "Search for administrative unit";
            beGeoSearch.Buttons[0].Kind    = ButtonPredefines.Glyph;
            beGeoSearch.Buttons[0].Caption = "Search";

            var toolTipTitle = new ToolTipTitleItem();
            toolTipTitle.Text = EidssMessages.GetForCurrentLang("gis_Geosearch_Tooltip", "Search for administrative unit");
            //"Search for administrative unit";
            var superToolTip = new SuperToolTip();
            superToolTip.Items.Add(toolTipTitle);

            var beiGeoSearch = new BarEditItem(barManager, beGeoSearch)
            {
                SmallWithoutTextWidth = 130,
                SmallWithTextWidth    = 130,
                Width    = 130,
                SuperTip = superToolTip
            };


            m_GeoSearch = new GeoSearch {
                MapControl = m_mapImage, ControlForVisualize = beiGeoSearch
            };

            geoSearchBar.AddItem(beiGeoSearch);
            beiGeoSearch.Visibility = BarItemVisibility.Always;

            beGeoSearch.ButtonClick += beGeoSearch_ButtonClick;


            #endregion

            //create map projects bar
            var mapsBar = new Bar(barManager, "MapProjects");
            mapsBar.OptionsBar.AllowDelete             = false;
            mapsBar.OptionsBar.AllowQuickCustomization = false;
            mapsBar.OptionsBar.DisableClose            = true;
            mapsBar.OptionsBar.DisableCustomization    = true;

            mapsBar.DockStyle           = BarDockStyle.Top;
            mapsBar.CanDockStyle        = BarCanDockStyle.Top;
            mapsBar.OptionsBar.BarState = BarState.Expanded;
            mapsBar.Visible             = true;
            mapsBar.DockRow             = 0;
            mapsBar.DockCol             = 0;
            mapsBar.ApplyDockRowCol();

            //create ExportImage Tool
            var mbb   = new MapBarButton();
            var mTool = new MtExportAsImage {
                MapImage = m_mapImage
            };
            mbb.MapTool = mTool;
            mapsBar.AddItem(mbb);

            //create Admin filter Tool
            mbb = new MapBarButton();
            var mTool1 = new MtAdminMask()
            {
                MapImage = m_mapImage
            };
            mbb.MapTool = mTool1;
            mapsBar.AddItem(mbb);

            //create MapSelectorTool
            var cmb = new RepositoryItemComboBox();
            var bei = new BarEditItem(barManager, cmb);
            bei.SmallWithoutTextWidth = 118;
            bei.SmallWithTextWidth    = 118;
            bei.Width = 118;

            if (m_MapSelector != null)
            {
                m_MapSelector.Dispose();
            }
            m_MapSelector = new MapSelector {
                MapControl = m_mapImage, ControlForVisualize = bei, Content = m_MapContent
            };
            m_MapSelector.MapChanging += m_MapSelector_MapChanging;

            mapsBar.AddItem(bei);

            barManager.EndUpdate();
        }