Exemple #1
0
        private void LoadMultiLineStrings()
        {
            // This query returns values that DO NOT EXIST in the MULTILINE GEOMETRY table
            // in case the user presses the Define MultiLine geometries button more than once.
            string  query = "SELECT * FROM NETWORK_DEFINITION WHERE ID_ NOT IN (SELECT DISTINCT FACILITY_ID AS ID_ FROM MULTILINE_GEOMETRIES_DEF)";
            DataSet doesNotExistInMultiLineGeometry = DBMgr.ExecuteQuery(query);

            string     strOutFile = GlobalDatabaseOperations.CreateBulkLoaderPath("MULTILINE_GEOMS", "txt");
            TextWriter tw         = new StreamWriter(strOutFile);

            foreach (DataRow multiGeomRow in doesNotExistInMultiLineGeometry.Tables[0].Rows)
            {
                Geometry geo = Geometry.GeomFromText(multiGeomRow["GEOMETRY"].ToString());
                if (geo is MultiLineString)
                {
                    MultiLineString multiLineGeom = (MultiLineString)geo;
                    foreach (LineString ls in multiLineGeom.LineStrings)
                    {
                        tw.WriteLine("\t" + multiGeomRow["ID_"].ToString() + "\t" + ls.ToString() + "\t\t\t");
                    }
                }
            }
            tw.Close();
            DBMgr.SQLBulkLoad("MULTILINE_GEOMETRIES_DEF", strOutFile, '\t');
        }
Exemple #2
0
        private void LoadViews()
        {
            TreeNode treeNodeViews = new TreeNode("Views", 19, 19);

            treeNodeViews.ContextMenuStrip = contextMenuStripViews;
            treeViewSolutionExplorer.Nodes.Add(treeNodeViews);
            try
            {
                ImageViewManager.Views = GlobalDatabaseOperations.GetViews();
            }
            catch (Exception except)
            {
                OutputWindow.WriteOutput("Error: Loading VIEWS from IMAGELOCATION table. " + except.Message);
                return;
            }

            foreach (String sView in ImageViewManager.Views)
            {
                TreeNode treeNodeView = new TreeNode(sView, 20, 20);
                treeNodeViews.Nodes.Add(treeNodeView);
                //FormImageViewer formImageView = new FormImageViewer(sView);
                //treeNodeView.Tag = formImageView;
                object[] parameters = new object[3];
                parameters[0]    = null;
                parameters[1]    = "ImageViewer";
                parameters[2]    = sView;
                treeNodeView.Tag = parameters;
            }
            treeNodeViews.ExpandAll();
        }
Exemple #3
0
        private void LoadReferenceType()
        {
            try
            {
                this.ReferenceTypes = GlobalDatabaseOperations.GetReferenceTypes();
                if (ReferenceTypes.Count == 0)
                {
                    OutputWindow.WriteOutput("Warning: IMAGELOCATION table is empty.");
                }

                foreach (String sReference in this.ReferenceTypes)
                {
                    toolStripComboBoxType.Items.Add(sReference);
                }
                String sReferenceDefault = Settings.Default.REFERENCETYPE;
                if (String.IsNullOrEmpty(sReferenceDefault) && this.ReferenceTypes.Count > 0)
                {
                    toolStripComboBoxType.SelectedIndex = 0;
                }
                else if (this.ReferenceTypes.Contains(sReferenceDefault))
                {
                    toolStripComboBoxType.Text = sReferenceDefault;
                }
                else if (this.ReferenceTypes.Count > 0)
                {
                    toolStripComboBoxType.SelectedIndex = 0;
                }
            }
            catch (Exception except)
            {
                OutputWindow.WriteOutput("Error: Error retrieving images from IMAGELOCATION table." + except.Message);
            }
        }
Exemple #4
0
        private void LoadFacility()
        {
            List <String> listFacility = null;

            toolStripComboBoxFacility.Items.Clear();

            try
            {
                listFacility = GlobalDatabaseOperations.GetNavigationFacility(toolStripComboBoxType.Text);
                foreach (String sFacility in listFacility)
                {
                    toolStripComboBoxFacility.Items.Add(sFacility);
                }

                String sFacilityDefault = Settings.Default.FACILITY;
                if (String.IsNullOrEmpty(sFacilityDefault) && listFacility.Count > 0)
                {
                    toolStripComboBoxFacility.SelectedIndex = 0;
                }
                else if (listFacility.Contains(sFacilityDefault))
                {
                    toolStripComboBoxFacility.Text = sFacilityDefault;
                }
                else if (listFacility.Count > 0)
                {
                    toolStripComboBoxFacility.SelectedIndex = 0;
                }
            }
            catch (Exception except)
            {
                OutputWindow.WriteOutput("Error: Retrieving Facility from IMAGELOCATION table. " + except.Message);
            }
        }
Exemple #5
0
 private void LoadSection()
 {
     toolStripComboBoxSection.Items.Clear();
     try
     {
         List <String> listSections;
         if (toolStripComboBoxDirection.Text != "")
         {
             listSections = GlobalDatabaseOperations.GetNavigationSection(toolStripComboBoxFacility.Text, toolStripComboBoxDirection.Text);
         }
         else
         {
             listSections = GlobalDatabaseOperations.GetNavigationSection(toolStripComboBoxFacility.Text);
         }
         foreach (String sSection in listSections)
         {
             toolStripComboBoxSection.Items.Add(sSection);
         }
         if (listSections.Count > 0)
         {
             toolStripComboBoxSection.SelectedIndex = 0;
         }
     }
     catch (Exception except)
     {
         OutputWindow.WriteOutput("Error: Filling Section list for Section Reference Facility. " + except.Message);
     }
 }
Exemple #6
0
        private void deleteToolStripMenuItem_Click(object sender, EventArgs e)
        {
            TreeNode tn = treeViewSolutionExplorer.SelectedNode;

            foreach (TreeNode treeNode in treeViewSolutionExplorer.SelectedNode.Nodes)
            {
                if (treeNode.Tag != null)
                {
                    object[] parameters = (object[])treeNode.Tag;
                    if (parameters[0] != null)
                    {
                        BaseForm form = (BaseForm)parameters[0];
                        form.Close();
                    }
                }
            }
            try
            {
                GlobalDatabaseOperations.RemoveNetwork(tn.Text);
                //Global.SecurityOperations.RemoveNetworkActions( tn.Text );
                tn.Remove();
            }
            catch (Exception except)
            {
                OutputWindow.WriteOutput("Error: Removing Network:" + tn.Text + ". " + except.Message);
            }
        }
Exemple #7
0
        /// <summary>
        /// Save data to ROLLUP_CONTROL
        /// </summary>
        /// <returns></returns>
        private bool SaveSegmentRollup()
        {
            List <RollupSegmentObject> listRollupSegment = new List <RollupSegmentObject>();

            foreach (DataGridViewRow row in dgvSegmentRollup.Rows)
            {
                RollupSegmentObject rollupSegment = new RollupSegmentObject();
                rollupSegment.Attribute     = row.Cells[0].Value.ToString();
                rollupSegment.RollupMethod  = row.Cells[1].Value.ToString();
                rollupSegment.SegmentMethod = row.Cells[2].Value.ToString();
                listRollupSegment.Add(rollupSegment);
            }

            try
            {
                GlobalDatabaseOperations.SetSegmentRollup(listRollupSegment, Network.NetworkID);
            }
            catch (Exception except)
            {
                OutputWindow.WriteOutput("Error: Updating ROLLUP_CONTROL table. " + except.Message);
                return(false);
            }
            if (!CreateDynamicSegmentation(listRollupSegment))
            {
                return(false);
            }

            return(true);
        }
Exemple #8
0
        private void LoadAttributes()
        {
            TreeNode treeNodeNetworkAttribute = new TreeNode("Raw Attributes", 8, 8);

            treeNodeNetworkAttribute.ContextMenuStrip = contextMenuStripRawAttribute;
            treeViewSolutionExplorer.Nodes.Add(treeNodeNetworkAttribute);

            List <String> listAttributes;

            try
            {
                listAttributes = GlobalDatabaseOperations.GetRawAttributes();
                foreach (String strAttribute in listAttributes)
                {
                    TreeNode treeNodeAttribute = new TreeNode(strAttribute, 2, 2);
                    treeNodeAttribute.ContextMenuStrip = contextMenuStripRawAttributeNode;
//                    FormAttributeDocument formAttributeDocument = new FormAttributeDocument(strAttribute);
//                    treeNodeAttribute.Tag = formAttributeDocument;
                    object[] parameters = new object[3];
                    parameters[0]         = null;
                    parameters[1]         = "RawAttribute";
                    parameters[2]         = strAttribute;
                    treeNodeAttribute.Tag = parameters;
                    treeNodeNetworkAttribute.Nodes.Add(treeNodeAttribute);
                }
            }
            catch (Exception except)
            {
                OutputWindow.WriteOutput("Error: Retrieve Raw Attibutes. " + except.Message);
            }
        }
Exemple #9
0
        private void LoadYearSection()
        {
            String strYear = toolStripComboBoxYear.Text;

            try
            {
                toolStripComboBoxYear.Items.Clear();
                List <String> listYears = GlobalDatabaseOperations.GetNavigationYearSRS(toolStripComboBoxFacility.Text);
                foreach (String sYear in listYears)
                {
                    toolStripComboBoxYear.Items.Add(sYear);
                }
                if (listYears.Contains(strYear))
                {
                    toolStripComboBoxYear.Text = strYear;
                }
                else if (listYears.Count > 0)
                {
                    toolStripComboBoxYear.SelectedIndex = 0;
                }
            }
            catch (Exception except)
            {
                OutputWindow.WriteOutput("Error: Filling Year List for Linear Facility. " + except.Message);
            }
        }
Exemple #10
0
        private void AddNetworkViewers(NetworkObject network, TreeNode tnNetwork)
        {
            try
            {
                int nCount = GlobalDatabaseOperations.GetSectionCountForNetwork(network.NetworkID);
            }
            catch//Catch is common occurence here.  If table is not rolled up.  Exception is thrown.
            {
                return;
            }
            //   TreeNode tn = new TreeNode("Construction History View", 13, 13);
            //   tnNetwork.Nodes.Add(tn);

            TreeNode tn = new TreeNode("Attribute View", 8, 8);

            tnNetwork.Nodes.Add(tn);
            this.AddAttributteNodes(network, tn);

            tn = new TreeNode("Section View", 10, 10);
            object[] parameters = new object[4];
            parameters[0] = null;
            parameters[1] = "SectionView";
            parameters[2] = network.Network;
            parameters[3] = network.NetworkID;
            tn.Tag        = parameters;
            tnNetwork.Nodes.Add(tn);

            tn = new TreeNode("Asset View", 12, 12);
            //FormAssetView formAssetView = new FormAssetView(network.NetworkID, Global.GetAttributeYear(network.NetworkID));
            //tn.Tag = formAssetView;
            parameters    = new object[3];
            parameters[0] = null;
            parameters[1] = "AssetView";
            parameters[2] = network.NetworkID;
            tn.Tag        = parameters;
            tnNetwork.Nodes.Add(tn);

            tn            = new TreeNode("GIS View", 18, 18);
            parameters    = new object[4];
            parameters[0] = null;
            parameters[1] = "GISViewer";
            parameters[2] = network.Network;
            parameters[3] = network.NetworkID;
            tn.Tag        = parameters;
            tnNetwork.Nodes.Add(tn);

            tn            = new TreeNode("Google View", 18, 18);
            parameters    = new object[4];
            parameters[0] = null;
            parameters[1] = "GoogleView";
            tn.Tag        = parameters;
            tnNetwork.Nodes.Add(tn);

            tn = new TreeNode("Feature View", 19, 19);
            //FormGoogleMap formGoogle = new FormGoogleMap();
            //tn.Tag = formGoogle;
            //tnNetwork.Nodes.Add(tn);
        }
Exemple #11
0
 private void LoadInitialStation()
 {
     try
     {
         String sStation = GlobalDatabaseOperations.GetNavigationStation(toolStripComboBoxFacility.Text, toolStripComboBoxDirection.Text);
         toolStripTextBoxStation.Text = sStation;
     }
     catch (Exception except)
     {
         OutputWindow.WriteOutput("Error: Retrieving Station from ImageLocation table. " + except.Message);
     }
 }
Exemple #12
0
        private bool CreateDynamicSegmentation(List <RollupSegmentObject> listRollupSegment)
        {
            //Delete all information for a given network.
            try
            {
                GlobalDatabaseOperations.DeleteCriteriaSegmentForNetwork(Network.NetworkID);
            }
            catch (Exception except)
            {
                OutputWindow.WriteOutput("Error: Deleting CRITERIA_SEGMENT. " + except.Message);
                return(false);
            }

            foreach (RollupSegmentObject rollupSegment in listRollupSegment)
            {
                if (rollupSegment.SegmentMethod != "-")
                {
                    try
                    {
                        GlobalDatabaseOperations.SaveCriteriaSegmentForNetwork(Network.NetworkID, rollupSegment);
                    }
                    catch (Exception except)
                    {
                        OutputWindow.WriteOutput("Error: Saving CRITERIA_SEGMENT. " + except.Message);
                    }
                }
            }

            // Start the segmentation process
            Global.WriteOutput("Segmentation Started: " + DateTime.Now.ToString());
            this.Cursor = Cursors.WaitCursor;
            DynamicSegmentation.DynamicSegmentation dynamic = new DynamicSegmentation.DynamicSegmentation();
            dynamic.DoSegmentation(Network.Network);
            if (SegmentationMessaging.GetProgressList().Count == 0)
            {
                OutputWindow.WriteOutput("Segmentation Completed: " + DateTime.Now.ToString());
            }
            else
            {
                foreach (String str in SegmentationMessaging.GetProgressList())
                {
                    OutputWindow.WriteOutput(str);
                }
            }
            this.Cursor = Cursors.Default;
            SegmentationMessaging.GetProgressList().Clear();
            return(true);
        }
Exemple #13
0
        private void addNewToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            NetworkProperties networkProp   = new NetworkProperties("");
            String            strNewNetwork = ShowProperties(true, networkProp, "Add New Network");

            try
            {
                List <NetworkObject> listNetworks  = GlobalDatabaseOperations.GetNetworks();
                NetworkObject        networkObject = listNetworks.Find(delegate(NetworkObject no) { return(no.Network == strNewNetwork); });
                if (networkObject != null)
                {
                    AddNewNetwork(networkObject);
                }
            }
            catch (Exception except)
            {
                OutputWindow.WriteOutput("Error: Error adding Network:" + strNewNetwork + ". " + except.Message);
            }
        }
Exemple #14
0
        private void LoadCalculatedAssets()
        {
            try
            {
                m_listAssets = GlobalDatabaseOperations.GetAssets();
            }
            catch (Exception ex)
            {
                Global.WriteOutput("Error: Retrieving RoadCare Assets from ASSET table." + ex.Message);
                return;
            }


            try
            {
                m_listCalculatedAssets = GlobalDatabaseOperations.GetCalculatedAssets();
            }
            catch (Exception ex)
            {
                Global.WriteOutput("Error: Retrieving RoadCare Calculated Assets from CALCULATED_ASSETS table. " + ex.Message);
                return;
            }
            DataGridViewComboBoxCell dgvComboAsset;

            foreach (CalculatedAssetObject asset in m_listCalculatedAssets)
            {
                int nIndex = dataGridViewCalculatedAssets.Rows.Add(asset.Asset, asset.CalculatedProperty, asset.Type, asset.Equation.Replace("|", "'"), asset.Criteria.Replace("|", "'"));
                dataGridViewCalculatedAssets.Rows[nIndex].Tag = asset.PrimaryKey;
                dgvComboAsset = (DataGridViewComboBoxCell)dataGridViewCalculatedAssets[0, nIndex];

                foreach (AssetObject assetTable in m_listAssets)
                {
                    dgvComboAsset.Items.Add(assetTable.Asset);
                }
            }

            dgvComboAsset = (DataGridViewComboBoxCell)dataGridViewCalculatedAssets[0, dataGridViewCalculatedAssets.Rows.Count - 1];
            foreach (AssetObject assetTable in m_listAssets)
            {
                dgvComboAsset.Items.Add(assetTable.Asset);
            }
        }
Exemple #15
0
        private void LoadDirection()
        {
            List <String> listDirection = null;

            toolStripComboBoxDirection.Items.Clear();
            try
            {
                listDirection = GlobalDatabaseOperations.GetNavigationDirection(toolStripComboBoxFacility.Text);
                foreach (String sDirection in listDirection)
                {
                    toolStripComboBoxDirection.Items.Add(sDirection);
                }
                if (listDirection.Count > 0)
                {
                    toolStripComboBoxDirection.SelectedIndex = 0;
                }
            }
            catch (Exception except)
            {
                OutputWindow.WriteOutput("Error: Retrieving Direction from IMAGELOCATION table. " + except.Message);
            }
        }
Exemple #16
0
        private void LoadNetworks()
        {
            TreeNode treeNodeNetwork = new TreeNode("Networks", 19, 19);

            m_tnNetworkRoot = treeNodeNetwork;
            treeNodeNetwork.ContextMenuStrip = contextMenuStripNetwork;
            treeViewSolutionExplorer.Nodes.Add(treeNodeNetwork);
            ImageViewManager.NetworkNode = treeNodeNetwork;

            try
            {
                ImageViewManager.Networks = GlobalDatabaseOperations.GetNetworks();
            }
            catch (Exception except)
            {
                OutputWindow.WriteOutput("Error: Loading Networks. " + except.Message);
            }

            foreach (NetworkObject networkObject in ImageViewManager.Networks)
            {
                AddNewNetwork(networkObject);
            }
        }
Exemple #17
0
        private void UpdateValueListBox(int nIndex)
        {
            if (!m_bUpdate)
            {
                return;            //Does this if RowEnter fired do to initialization.
            }
            DataGridViewRow row          = dgvSegmentRollup.Rows[nIndex];
            String          strAttribute = row.Cells["Attribute"].Value.ToString();

            listBoxAttributeValues.Items.Clear();

            try
            {
                List <String> listValues = GlobalDatabaseOperations.GetRawAttributeValue(strAttribute, checkBoxShowAvailable.Checked);
                foreach (String strValue in listValues)
                {
                    listBoxAttributeValues.Items.Add(strValue);
                }
            }
            catch (Exception except)
            {
                OutputWindow.WriteOutput("Error: Retrieving values from Raw Attribute table: " + strAttribute + ". " + except.Message);
            }
        }
Exemple #18
0
        private void FormAssetToAttribute_Load(object sender, EventArgs e)
        {
            List <AttributeObject> listAssetAttributes = GlobalDatabaseOperations.GetAssetToAttributes();

            try
            {
                m_listAsset = GlobalDatabaseOperations.GetAssets();
            }
            catch (Exception ex)
            {
                Global.WriteOutput("Error: Retrieving RoadCare Assets from ASSET table." + ex.Message);
                return;
            }



            String strAsset = "";

            foreach (AttributeObject attributeObject in listAssetAttributes)
            {
                if (attributeObject.Type == "NUMBER")
                {
                    int nIndexTag = dataGridViewAssetToAttribute.Rows.Add(attributeObject.Asset, attributeObject.AssetProperty, attributeObject.Attribute, attributeObject.Format, attributeObject.DefaultNumber, attributeObject.Minimum, attributeObject.Maximum);
                    dataGridViewAssetToAttribute.Rows[nIndexTag].Tag = attributeObject.Type;
                }
                else
                {
                    int nIndexTag = dataGridViewAssetToAttribute.Rows.Add(attributeObject.Asset, attributeObject.AssetProperty, attributeObject.Attribute, "", attributeObject.DefaultString, "", "");
                    dataGridViewAssetToAttribute.Rows[nIndexTag].Tag = attributeObject.Type;
                }
            }

            int nIndex = 0;
            DataGridViewComboBoxCell dgvComboAsset;

            foreach (DataGridViewRow row in dataGridViewAssetToAttribute.Rows)
            {
                dgvComboAsset = (DataGridViewComboBoxCell)dataGridViewAssetToAttribute[0, nIndex];
                dataGridViewAssetToAttribute[2, nIndex].ReadOnly = true;
                foreach (AssetObject assetTable in m_listAsset)
                {
                    dgvComboAsset.Items.Add(assetTable.Asset);
                }
                nIndex++;
            }
            DataGridViewComboBoxCell dgvComboProperty;
            List <String>            listProperty;

            nIndex = 0;
            foreach (DataGridViewRow row in dataGridViewAssetToAttribute.Rows)
            {
                if (dataGridViewAssetToAttribute[0, nIndex].Value != null)
                {
                    dgvComboProperty = (DataGridViewComboBoxCell)dataGridViewAssetToAttribute[1, nIndex];
                    strAsset         = dataGridViewAssetToAttribute[0, nIndex].Value.ToString();
                    listProperty     = DBMgr.GetTableColumns(strAsset);
                    foreach (String strProperty in listProperty)
                    {
                        dgvComboProperty.Items.Add(strProperty);
                    }
                }
                nIndex++;
            }
        }
Exemple #19
0
        private void LoadGridViewAttributes()
        {
            m_bUpdate = false;
            dgvSegmentRollup.Rows.Clear();
            List <AttributeObject>     listAttribute = null;
            List <RollupSegmentObject> listRollup    = null;

            try
            {
                listAttribute = GlobalDatabaseOperations.GetAttributes();
            }
            catch (Exception except)
            {
                OutputWindow.WriteOutput("Error: Loading ATTRIBUTE table. " + except.Message);
                return;
            }

            try
            {
                listRollup = GlobalDatabaseOperations.GetSegmentRollup(this.Network.NetworkID);
            }
            catch (Exception except)
            {
                OutputWindow.WriteOutput("Error: Loading ROLLUP_CONTROL table. " + except.Message);
                return;
            }



            foreach (AttributeObject attribute in listAttribute)
            {
                if (attribute.Calculated == false)
                {
                    int nRow = dgvSegmentRollup.Rows.Add(attribute.Attribute);
                    DataGridViewComboBoxCell combo = (DataGridViewComboBoxCell)dgvSegmentRollup[1, nRow];
                    dgvSegmentRollup.Rows[nRow].Cells[0].ReadOnly = true;
                    if (attribute.Type == "NUMBER")
                    {
                        combo.Items.Add("None");
                        combo.Items.Add("Average");
                        combo.Items.Add("Predominant");
                        combo.Items.Add("Median");
                        combo.Items.Add("Maximum");
                        combo.Items.Add("Minimum");
                        combo.Items.Add("Median");
                        combo.Items.Add("Absolute Maximum");
                        combo.Items.Add("Absolute Minimum");
                        combo.Items.Add("Standard Deviation");
                        combo.Items.Add("Sum");
                    }
                    else
                    {
                        combo.Items.Add("None");
                        combo.Items.Add("Average");
                        combo.Items.Add("Predominant");
                    }

                    RollupSegmentObject rollup = listRollup.Find(delegate(RollupSegmentObject rso) { return(rso.Attribute == attribute.Attribute); });
                    if (rollup != null)
                    {
                        dgvSegmentRollup.Rows[nRow].Cells[1].Value = rollup.RollupMethod;
                        dgvSegmentRollup.Rows[nRow].Cells[2].Value = rollup.SegmentMethod;
                    }
                    else
                    {
                        if (attribute.Type == "STRING")
                        {
                            dgvSegmentRollup.Rows[nRow].Cells[1].Value = "Predominant";
                        }
                        else
                        {
                            dgvSegmentRollup.Rows[nRow].Cells[1].Value = "Average";
                        }
                        dgvSegmentRollup.Rows[nRow].Cells[2].Value = "-";
                    }
                }
            }
            m_bUpdate = true;
        }