Exemple #1
0
        private void ThreeDimLayerBtn_Click(object sender, RoutedEventArgs e)
        {
            DGObjectsDefinition DObjsDef = DObjsDefGrid.DataContext as DGObjectsDefinition;

            if (DObjsDef == null)
            {
                return;
            }

            if (_u3dLayer == null)
            {
                PromptTB.Text = "Click the button again until the 3D model is loaded.";
                Preview3DLayerBtn_Click(this, null);
                return;
            }

            Select3DEMapLayersWindow select3DEMapLayersWnd = new Select3DEMapLayersWindow(_u3dLayer);

            select3DEMapLayersWnd.Owner = this;
            select3DEMapLayersWnd.WindowStartupLocation = WindowStartupLocation.CenterOwner;
            bool?ok = select3DEMapLayersWnd.ShowDialog();

            if (ok != null && ok.Value == true)
            {
                if (select3DEMapLayersWnd.SelectLayerName != null)
                {
                    Layer3DNameTB.Text   = select3DEMapLayersWnd.SelectLayerName;
                    DObjsDef.Layer3DName = select3DEMapLayersWnd.SelectLayerName;
                }
            }
        }
Exemple #2
0
        public bool LoadSecondlining(DGObjects objs)
        {
            DGObjectsDefinition def = objs.definition;

            if (def == null)
            {
                return(false);
            }
            bool success = _dbLoader.ReadSecondlining(objs,
                                                      def.TableNameSQL, def.ConditionSQL, def.OrderSQL);

            return(success);
        }
        // Summary:
        //    Re-read monitoring point.
        //    This is usually for loading all the monitoring records.
        //
        public bool ReloadMonPoints(DGObjects objs, string conditionSQL)
        {
            DGObjectsDefinition def = objs.definition;

            if (def == null)
            {
                return(false);
            }
            bool success = _dbLoader.RereadMonPoints(objs,
                                                     def.TableNameSQL, conditionSQL, def.OrderSQL);

            return(success);
        }
Exemple #4
0
        private void DObjsLB_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            // Check if this is triggered by clearing event
            if (DObjsLB.ItemsSource == null)
            {
                DObjsDefGrid.DataContext = null;
                return;
            }

            KeyValuePair <string, DGObjectsDefinition> item =
                (KeyValuePair <string, DGObjectsDefinition>)DObjsLB.SelectedItem;
            DGObjectsDefinition DObjsDef = item.Value;

            DObjsDefGrid.DataContext = DObjsDef;
        }
Exemple #5
0
        private void PreviewTableBtn_Click(object sender, RoutedEventArgs e)
        {
            string dbFile = _prjDef.LocalFilePath + "\\" + _prjDef.LocalDatabaseName;
            DGObjectsDefinition dObjsDef = DObjsDefGrid.DataContext as DGObjectsDefinition;

            if (dObjsDef == null)
            {
                return;
            }

            DataSet dataSet = DbHelper.LoadTable(dbFile,
                                                 dObjsDef.TableNameSQL, dObjsDef.ConditionSQL, dObjsDef.OrderSQL);

            PreviewTableWindow previewTblWnd = new PreviewTableWindow(TableNameTB.Text, dataSet);

            previewTblWnd.Owner = this.Owner;
            previewTblWnd.WindowStartupLocation = WindowStartupLocation.CenterOwner;
            previewTblWnd.Show();
        }
Exemple #6
0
        // Convert an instance of DGObjecsDefinition class to XElement
        //
        public static XElement DGObjDef2XElement(DGObjectsDefinition objDef)
        {
            XElement xe = new XElement(objDef.Type);

            xe.Add(new XAttribute("Name", objDef.Name));

            // NOTE: remove "dbo_" prefix of the table name!!!
            //
            string tableName = objDef.TableNameSQL.Replace(DbHelper.TablePrefix, "");

            xe.Add(new XAttribute("TableNameSQL", tableName));

            if (objDef.DefNamesSQL != null)
            {
                xe.Add(new XAttribute("DefNamesSQL", objDef.DefNamesSQL));
            }
            if (objDef.ConditionSQL != null)
            {
                xe.Add(new XAttribute("ConditionSQL", objDef.ConditionSQL));
            }
            if (objDef.OrderSQL != null)
            {
                xe.Add(new XAttribute("OrderSQL", objDef.OrderSQL));
            }

            xe.Add(new XAttribute("HasGeometry", objDef.HasGeometry));
            if (objDef.GISLayerName != null)
            {
                xe.Add(new XAttribute("GISLayerName", objDef.GISLayerName));
            }

            xe.Add(new XAttribute("Has3D", objDef.Has3D));
            if (objDef.Layer3DName != null)
            {
                xe.Add(new XAttribute("Layer3DName", objDef.Layer3DName));
            }

            return(xe);
        }
Exemple #7
0
        private void AddDObj_Click(object sender, RoutedEventArgs e)
        {
            // In case there is no domain, just return.
            if (DomainListLB.Items.Count == 0)
            {
                return;
            }

            Dictionary <string, DGObjectsDefinition> objsDefinitions =
                DObjsLB.ItemsSource as Dictionary <string, DGObjectsDefinition>;
            AddDObjWindow addDObjWnd = new AddDObjWindow(objsDefinitions);

            addDObjWnd.Owner = this;
            addDObjWnd.WindowStartupLocation = WindowStartupLocation.CenterOwner;
            bool?ok = addDObjWnd.ShowDialog();

            if (ok != null && ok.Value == true)
            {
                string name = addDObjWnd.DObjName;
                DGObjectsDefinition dObjDef = new DGObjectsDefinition();
                dObjDef.Name = name;
                objsDefinitions.Add(name, dObjDef);

                // force update UI
                int index = DObjsLB.SelectedIndex;
                DObjsLB.ItemsSource = null;
                DObjsLB.ItemsSource = objsDefinitions;
                if (index != -1)
                {
                    DObjsLB.SelectedIndex = index;
                }
                else
                {
                    DObjsLB.SelectedIndex = 0;
                }
            }
        }
Exemple #8
0
        private void TableNameSQLBtn_Click(object sender, RoutedEventArgs e)
        {
            DGObjectsDefinition DObjsDef = DObjsDefGrid.DataContext as DGObjectsDefinition;

            if (DObjsDef == null)
            {
                return;
            }

            string        dbFile = _prjDef.LocalFilePath + "\\" + _prjDef.LocalDatabaseName;
            List <string> names  = DbHelper.GetDbTablenames(dbFile);

            SelectTableNamesWindow selectTableNamesWnd = new SelectTableNamesWindow(names, TableNameTB.Text);

            selectTableNamesWnd.Owner = this;
            selectTableNamesWnd.WindowStartupLocation = WindowStartupLocation.CenterOwner;
            bool?ok = selectTableNamesWnd.ShowDialog();

            if (ok != null && ok.Value == true)
            {
                TableNameTB.Text      = selectTableNamesWnd.SelectedName;
                DObjsDef.TableNameSQL = selectTableNamesWnd.SelectedName;
            }
        }
Exemple #9
0
        private void TwoDimLayerBtn_Click(object sender, RoutedEventArgs e)
        {
            DGObjectsDefinition DObjsDef = DObjsDefGrid.DataContext as DGObjectsDefinition;

            if (DObjsDef == null)
            {
                return;
            }

            SelectEMapLayersWindow selectEMapLayersWnd = new SelectEMapLayersWindow(_eMapLayersList);

            selectEMapLayersWnd.Owner = this;
            selectEMapLayersWnd.WindowStartupLocation = WindowStartupLocation.CenterOwner;
            bool?ok = selectEMapLayersWnd.ShowDialog();

            if (ok != null && ok.Value == true)
            {
                if (selectEMapLayersWnd.SelectedLayerName != null)
                {
                    LayerNameTB.Text      = selectEMapLayersWnd.SelectedLayerName;
                    DObjsDef.GISLayerName = selectEMapLayersWnd.SelectedLayerName;
                }
            }
        }