コード例 #1
0
        /// <summary>Get the gipod parameters </summary>
        private dataHandler.gipodParam getGipodParam()
        {
            //get parameters form GUI
            dataHandler.gipodParam param = new dataHandler.gipodParam();
            param.city      = cityCombo.Text;
            param.province  = provinceCombo.Text;
            param.owner     = ownerCombo.Text;
            param.startdate = startdatePicker.Value;
            param.enddate   = enddatePicker.Value;

            param.crs = dataHandler.CRS.Lambert72;

            if (manifestationRadio.Checked)
            {
                param.gipodType = dataHandler.gipodtype.manifestation;
                param.eventtype = eventTypeCombo.Text;
            }
            else
            {
                param.gipodType = dataHandler.gipodtype.workassignment;
                param.eventtype = "";
            }
            //set bounds
            if (useExtendChk.Checked)
            {
                IEnvelope arcGIsBbox = geopuntHelper.Transform(view.Extent, lam72) as IEnvelope;
                param.bbox = new boundingBox(arcGIsBbox);
            }
            else
            {
                param.bbox = null;
            }
            return(param);
        }
コード例 #2
0
        private List <datacontract.gipodResponse> fetchGipod(dataHandler.gipodParam param)
        {
            //get parameters form GUI
            string city     = param.city;
            string province = param.province;
            string owner    = param.owner;

            string eventtype = param.eventtype;

            DateTime startdate = param.startdate;
            DateTime enddate   = param.enddate;

            dataHandler.CRS crs = param.crs;

            //get data from gipod
            List <datacontract.gipodResponse> response;

            if (param.bbox == null)
            {
                if (param.gipodType == dataHandler.gipodtype.manifestation)
                {
                    response = gipod.allManifestations(startdate, enddate, city, province, owner, eventtype, crs);
                    return(response);
                }
                else if (param.gipodType == dataHandler.gipodtype.workassignment)
                {
                    response = gipod.allWorkassignments(startdate, enddate, city, province, owner, crs);
                    return(response);
                }
                else
                {
                    return(null);
                }
            }
            else
            {
                if (param.gipodType == dataHandler.gipodtype.manifestation)
                {
                    response = gipod.allManifestations(startdate, enddate, city, province, owner, eventtype, crs, param.bbox);
                    return(response);
                }
                else if (param.gipodType == dataHandler.gipodtype.workassignment)
                {
                    response = gipod.allWorkassignments(startdate, enddate, city, province, owner, crs, param.bbox);
                    return(response);
                }
                else
                {
                    return(null);
                }
            }
        }
コード例 #3
0
        private void saveAsShapeBtn_Click(object sender, EventArgs e)
        {
            try
            {
                string shapeCreated;
                shapeCreated = geopuntHelper.ShowSaveDataDialog("Opslaan als");

                //if user canceled shapeCreated is null
                if (shapeCreated == null)
                {
                    return;
                }

                bool deleted = geopuntHelper.deleteFeatureClass(shapeCreated);

                if (!deleted)
                {
                    MessageBox.Show("Kan file de onderaande file niet deleten: \n" + shapeCreated);
                    return;
                }
                FileInfo featureClassPath = new FileInfo(shapeCreated);

                dataHandler.gipodParam param = getGipodParam();

                List <datacontract.gipodResponse> gipodRecords = fetchGipod(param);

                if (gipodRecords.Count > 0)
                {
                    messageLbl.Text = String.Format("{0} objecten gevonden in GIPOD, aan het schrijven naar shapefile", gipodRecords.Count);

                    //create shapefile or FeatureClass
                    List <IField> gipodfields;
                    IFeatureClass gipodFC;
                    if (shapeCreated.ToLowerInvariant().EndsWith(".shp"))
                    {
                        gipodfields = gipodIFields(param.gipodType, true);
                        gipodFC     = geopuntHelper.createShapeFile(shapeCreated, gipodfields, view.FocusMap.SpatialReference,
                                                                    esriGeometryType.esriGeometryPoint);
                    }
                    else if (featureClassPath.DirectoryName.ToLowerInvariant().EndsWith(".gdb"))
                    {
                        gipodfields = gipodIFields(param.gipodType, false);
                        gipodFC     = geopuntHelper.createFeatureClass(featureClassPath.DirectoryName, featureClassPath.Name,
                                                                       gipodfields, view.FocusMap.SpatialReference, esriGeometryType.esriGeometryPoint);
                    }
                    else
                    {
                        throw new Exception("Is geen feature class of shapefile.");
                    }

                    populateGipodShape(gipodFC, gipodRecords, param.gipodType);

                    IFeatureLayer gipodLayer = geopuntHelper.addFeatureClassToMap(view, gipodFC, false);
                    styleGipodLyr(gipodLayer as IGeoFeatureLayer);

                    view.Refresh();
                    this.Close();
                }
                else
                {
                    saveAsShapeBtn.Enabled = true;
                    messageLbl.Text        = "Geen records gevonden in gipod, die voldoen aan deze parameters";
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + " : " + ex.StackTrace);
            }
        }
コード例 #4
0
ファイル: gipodForm.cs プロジェクト: geopunt/geopunt4arcgis
        /// <summary>Get the gipod parameters </summary>
        private dataHandler.gipodParam getGipodParam()
        {
            //get parameters form GUI
            dataHandler.gipodParam param = new dataHandler.gipodParam();
            param.city = cityCombo.Text;
            param.province = provinceCombo.Text;
            param.owner = ownerCombo.Text;
            param.startdate = startdatePicker.Value;
            param.enddate = enddatePicker.Value;

            param.crs = dataHandler.CRS.Lambert72;

            if (manifestationRadio.Checked)
            {
                param.gipodType = dataHandler.gipodtype.manifestation;
                param.eventtype = eventTypeCombo.Text;
            }
            else
            {
                param.gipodType = dataHandler.gipodtype.workassignment;
                param.eventtype = "";
            }
            //set bounds
            if (useExtendChk.Checked)
            {
                IEnvelope arcGIsBbox = geopuntHelper.Transform(view.Extent, lam72) as IEnvelope;
                param.bbox = new boundingBox(arcGIsBbox);
            }
            else
            {
                param.bbox = null;
            }
            return param;
        }