public ObservableCollection <Obj> UpdateOpenningModelHasSynchToListObject(Document document, Handling handling)
        {
            ObservableCollection <Obj> objs = new ObservableCollection <Obj>();
            // ServerNormalStatus
            IClassify ServerNormalStatus = handling.ServerNormalStatus;
            CompareClassifyLocalStatus     compareClassifyLocalStatusNomal = ServerNormalStatus.Data;
            List <ComparisonCoupleElement> deletedLocal = compareClassifyLocalStatusNomal.DeletedLocal;

            FindAndAddListComparisonCoupleElement(document, deletedLocal, objs);
            List <ComparisonCoupleElement> normalLocal = compareClassifyLocalStatusNomal.NormalLocal;

            FindAndAddListComparisonCoupleElement(document, normalLocal, objs);
            // ServerPendingCreateStatus
            IClassify ServerPendingCreateStatus = handling.ServerPendingCreateStatus;
            CompareClassifyLocalStatus compareClassifyLocalStatusPendingCreate = ServerPendingCreateStatus.Data;

            deletedLocal = compareClassifyLocalStatusPendingCreate.DeletedLocal;
            FindAndAddListComparisonCoupleElement(document, deletedLocal, objs);
            normalLocal = compareClassifyLocalStatusPendingCreate.NormalLocal;
            FindAndAddListComparisonCoupleElement(document, normalLocal, objs);
            // ServerPendingDeleteStatus
            IClassify ServerPendingDeleteStatus = handling.ServerPendingDeleteStatus;
            CompareClassifyLocalStatus compareClassifyLocalStatusPendingDelete = ServerPendingDeleteStatus.Data;

            deletedLocal = compareClassifyLocalStatusPendingDelete.DeletedLocal;
            FindAndAddListComparisonCoupleElement(document, deletedLocal, objs);
            normalLocal = compareClassifyLocalStatusPendingDelete.NormalLocal;
            FindAndAddListComparisonCoupleElement(document, normalLocal, objs);
            return(objs);
        }
Beispiel #2
0
        public static void classifyRender(IRasterLayer rastlayer, string classMethod, int count, IColorRamp ramp)
        {
            try
            {
                IRasterBand band = GetBand(rastlayer);
                if (band.Histogram == null)
                {
                    band.ComputeStatsAndHist();
                }
                IRasterClassifyColorRampRenderer rasClassifyRender = new RasterClassifyColorRampRendererClass();
                IRasterRenderer rasRender = rasClassifyRender as IRasterRenderer;
                rasRender.Raster = rastlayer.Raster;
                rasRender.Update();

                int       numClasses = count;
                IClassify classify   = null;

                switch (classMethod)
                {
                case "等间距分级":
                    classify = new EqualIntervalClass();
                    break;

                case "自然断点分级":
                    classify = new NaturalBreaksClass();
                    break;
                }
                classify.Classify(ref numClasses);

                double[] Classes = classify.ClassBreaks as double[];
                UID      pUid    = classify.ClassID;
                IRasterClassifyUIProperties rasClassifyUI = rasClassifyRender as IRasterClassifyUIProperties;
                rasClassifyUI.ClassificationMethod = pUid;
                rasClassifyRender.ClassField       = "Value";
                rasClassifyRender.ClassCount       = count;
                rasRender.Update();
                IColor            pColor;
                ISimpleFillSymbol pSym;

                for (int j = 0; j < count; j++)
                {
                    pColor     = ramp.get_Color(j * (ramp.Size - 1) / (count - 1));
                    pSym       = new SimpleFillSymbolClass();
                    pSym.Color = pColor;
                    rasClassifyRender.set_Symbol(j, (ISymbol)pSym);
                    rasClassifyRender.set_Break(j, rasClassifyRender.get_Break(j));
                }
                rasRender.Update();

                rastlayer.Renderer = rasClassifyRender as IRasterRenderer;
            }
            catch
            {
                XtraMessageBox.Show("唯一值数量已达到限制(65536)");
            }
        }
        public DetailsForm(IClassify classifyEngine, ICategories categories, string rawText)
        {
            _htmlDisplay = new HtmlDisplay(classifyEngine, categories, rawText);

            // we can now init everything.
            InitializeComponent();

            // maximized the window.
            WindowState = FormWindowState.Maximized;
        }
Beispiel #4
0
        private void method_1()
        {
            object[] objArray = new object[3];
            this.listView1.Items.Clear();
            this.lblLabelInfo.Text = (this.itinColorRampRenderer_0 as ITinRenderer).Name;
            for (int i = 0; i < this.itinColorRampRenderer_0.BreakCount; i++)
            {
                objArray[0] = this.itinColorRampRenderer_0.get_Symbol(i);
                objArray[1] =
                    (this.itinColorRampRenderer_0 as IClassBreaksUIProperties).get_LowBreak(
                        (this.itinColorRampRenderer_0.BreakCount - 1) - i).ToString("0.###") + " - " +
                    this.itinColorRampRenderer_0.get_Break((this.itinColorRampRenderer_0.BreakCount - 1) - i)
                    .ToString("0.###");
                objArray[2] = this.itinColorRampRenderer_0.get_Label(i);
                this.listView1.Add(objArray);
            }
            this.cboClassifyNum.SelectedIndex = this.itinColorRampRenderer_0.BreakCount - 1;
            UID method = (this.itinColorRampRenderer_0 as IClassBreaksUIProperties).Method;

            if (method.Value.ToString() == "{00000000-0000-0000-0000-000000000000}")
            {
                this.cboClassifyMethod.SelectedIndex = 0;
                this.cboClassifyNum.Enabled          = false;
            }
            else
            {
                this.cboClassifyNum.Enabled = true;
                IClassify classify = this.method_2(method) as IClassify;
                if (classify != null)
                {
                    this.Classifygroup.Enabled = true;
                    switch (classify.MethodName)
                    {
                    case "Equal Interval":
                    case "等间隔":
                        this.cboClassifyMethod.SelectedIndex = 1;
                        break;

                    case "Quantile":
                    case "分位数":
                        this.cboClassifyMethod.SelectedIndex = 2;
                        break;

                    case "Natural Breaks (Jenks)":
                    case "自然间隔(Jenks)":
                        this.cboClassifyMethod.SelectedIndex = 3;
                        break;
                    }
                }
                else
                {
                    this.Classifygroup.Enabled = false;
                }
            }
        }
Beispiel #5
0
 public Proc_Gesture(IClassify classify, IDataManager dataManager, IVectorHelper vectorHelper,
                     ConcurrentQueue <Frame> inStream, ConcurrentQueue <int> midiOutStream,
                     ConcurrentQueue <Joints> targetOutStream)
 {
     gesture      = classify;
     cache        = dataManager;
     vh           = vectorHelper;
     frameStream  = inStream;
     midiStream   = midiOutStream;
     targetStream = targetOutStream;
 }
        public HtmlDisplay(IClassify classifyEngine, ICategories categories, string rawText)
        {
            // the raw text
            _rawText = rawText;

            // the categories
            _categories = categories;

            // the classifier engine
            _classifyEngine = classifyEngine;
        }
Beispiel #7
0
        public virtual IClassificationResult FinishEvaluation(bool clear)
        {
            IClassificationResult classificationResult = null;

            if (blobTracker != null)
            {
                TrackedGesture trackedGesture = blobTracker.TrackedBlobs;
                RecognitionMode = false;
                if (blobTracker.Trajectories.Count > 0)
                {
                    Console.WriteLine("Gesture trajectories to evaluate:" + blobTracker.Trajectories.Count);
                    List <IClassificationResult> oldResults = new List <IClassificationResult>();
                    // foreach (IClassify classifier in classifiers){
                    for (int i = 0; i < classifiers.Count; i++)
                    {
                        IClassify classifier = classifiers[i];
                        if (classifier != null)
                        {
                            classificationResult = classifier.Classify(blobTracker.FrameList, blobTracker.Trajectories);
                            if (classificationResult != null)
                            {
                                if (classificationResult.Probability > ProbabilityThreshold)
                                {
                                    break;
                                }
                                else
                                {
                                    oldResults.Add(classificationResult);
                                }
                            }
                        }
                    }

                    // no result was taken directly, so find the first one with the highest probability
                    if (oldResults != null && oldResults.Count > 0)
                    {
                        foreach (var result in oldResults)
                        {
                            if (classificationResult == null || result.Probability > classificationResult.Probability)
                            {
                                classificationResult = result;
                            }
                        }
                    }
                }
                if (clear)
                {
                    blobTracker.InitiateTracking();
                }
            }
            return(classificationResult);
        }
        private void UpdatePendingCreateStatus(Transaction transaction, Handling handling)
        {
            IClassify classifyNomalStatus = handling.ServerPendingCreateStatus;
            CompareClassifyLocalStatus compareClassifyLocalStatusNomal = classifyNomalStatus.Data;
            //get local status
            IEnumerable <ComparisonCoupleElement> deletedLocal = compareClassifyLocalStatusNomal.DeletedLocal;

            foreach (ComparisonCoupleElement comparisonCoupleElement in deletedLocal)
            {
                // tuân theo sever
                if (comparisonCoupleElement.Action == Model.Action.PULL)
                {
                    LoadFammilyInstance(transaction, comparisonCoupleElement);
                }
            }
        }
        private void UpdateNomalStatus(Transaction transaction, Handling handling)
        {
            IClassify classifyNomalStatus = handling.ServerNormalStatus;
            CompareClassifyLocalStatus compareClassifyLocalStatusNomal = classifyNomalStatus.Data;
            //get local status
            IEnumerable <ComparisonCoupleElement> deletedLocal = compareClassifyLocalStatusNomal.DeletedLocal;

            foreach (ComparisonCoupleElement comparisonCoupleElement in deletedLocal)
            {
                // tuân theo sever
                if (comparisonCoupleElement.Action == Model.Action.PULL)
                {
                    LoadFammilyInstance(transaction, comparisonCoupleElement);
                }
            }
            IEnumerable <ComparisonCoupleElement> nomalLocal = compareClassifyLocalStatusNomal.NormalLocal;

            foreach (ComparisonCoupleElement comparisonCoupleElement in nomalLocal)
            {
                if (!comparisonCoupleElement.IsSameShapeAndLocation())
                {
                    if (comparisonCoupleElement.Action == Model.Action.PULL &&
                        Common.IsValidGuid(comparisonCoupleElement.IdRevitElement))
                    {
                        if (comparisonCoupleElement.IsSameTypeGeometry())
                        {
                            Element element = _doc.GetElement(comparisonCoupleElement.IdRevitElement);
                            UpdateGeometryAndDirection(transaction, element, comparisonCoupleElement);
                        }
                        else
                        {
                            Element element = _doc.GetElement(comparisonCoupleElement.IdRevitElement);
                            transaction.Start("Delete Opening");
                            _doc.Delete(element.Id);
                            transaction.Commit();
                            LoadFammilyInstance(transaction, comparisonCoupleElement);
                        }
                    }
                }
            }
        }
        public static void InitCurrenVersionOpeningOnLocal(this IClassify classify, List <VersionGeometryOfElementInRevision> versionGeometries)
        {
            if (classify.Data == null)
            {
                return;
            }
            var data = classify.Data;

            if (data.NormalLocal.Count > 0)
            {
                foreach (var eleCompare in data.NormalLocal)
                {
                    if (!string.IsNullOrEmpty(eleCompare.IdRevitElement))
                    {
                        var eleFind = versionGeometries.FirstOrDefault(x => Common.IsValidGuid(x.IdLocal) &&
                                                                       Common.IsValidGuid(eleCompare.IdRevitElement) &&
                                                                       x.IdLocal.Equals(eleCompare.IdRevitElement));
                        if (eleFind != null)
                        {
                            eleCompare.CurrentVersionGeometryOfLocal = eleFind.VersionGeometry;
                        }
                    }
                }
            }
            if (data.DeletedLocal.Count > 0)
            {
                foreach (var eleCompare in data.DeletedLocal)
                {
                    if (!string.IsNullOrEmpty(eleCompare.IdRevitElement))
                    {
                        var eleFind = versionGeometries.FirstOrDefault(x => Common.IsValidGuid(x.IdLocal) &&
                                                                       Common.IsValidGuid(eleCompare.IdRevitElement) &&
                                                                       x.IdLocal.Equals(eleCompare.IdRevitElement));
                        if (eleFind != null)
                        {
                            eleCompare.CurrentVersionGeometryOfLocal = eleFind.VersionGeometry;
                        }
                    }
                }
            }
        }
        private void UpdatePendingDeleteStatus(Transaction transaction, Handling handling)
        {
            transaction.Start("delete element");
            IClassify classifyNomalStatus = handling.ServerPendingDeleteStatus;
            CompareClassifyLocalStatus compareClassifyLocalStatusNomal = classifyNomalStatus.Data;
            //get local status
            IEnumerable <ComparisonCoupleElement> nomalLocal = compareClassifyLocalStatusNomal.NormalLocal;

            foreach (ComparisonCoupleElement comparisonCoupleElement in nomalLocal)
            {
                if (!comparisonCoupleElement.IsSameShapeAndLocation())
                {
                    if (comparisonCoupleElement.Action == Model.Action.PULL &&
                        Common.IsValidGuid(comparisonCoupleElement.IdRevitElement))
                    {
                        Element element = _doc.GetElement(comparisonCoupleElement.IdRevitElement);
                        _doc.Delete(element.Id);
                    }
                }
            }
            transaction.Commit();
        }
        private void method_5(IColorRamp icolorRamp_1, IClassBreaksRenderer iclassBreaksRenderer_1, int int_0,
                              ITable itable_0, string string_0, string string_1, esriDataNormalization esriDataNormalization_0)
        {
            try
            {
                esriGeometryType esriGeometryAny = esriGeometryType.esriGeometryAny;
                if (this.igeoFeatureLayer_0.FeatureClass != null)
                {
                    esriGeometryAny = this.igeoFeatureLayer_0.FeatureClass.ShapeType;
                }
                IClassify classify =
                    this.method_2((iclassBreaksRenderer_1 as IClassBreaksUIProperties).Method) as IClassify;
                if (classify != null)
                {
                    object          obj2;
                    object          obj3;
                    bool            flag;
                    ITableHistogram histogram = new BasicTableHistogramClass
                    {
                        Field     = string_0,
                        Table     = itable_0,
                        NormField = string_1
                    };
                    (histogram as IDataNormalization).NormalizationType = esriDataNormalization_0;
                    (histogram as IBasicHistogram).GetHistogram(out obj2, out obj3);
                    if (classify is IClassifyMinMax2)
                    {
                        double minimum = (histogram as IStatisticsResults).Minimum;
                        double maximum = (histogram as IStatisticsResults).Maximum;
                        (classify as IClassifyMinMax2).ClassifyMinMax(minimum, maximum, ref int_0);
                    }
                    else if (classify is IDeviationInterval)
                    {
                        (classify as IDeviationInterval).Mean        = (histogram as IStatisticsResults).Mean;
                        (classify as IDeviationInterval).StandardDev =
                            (histogram as IStatisticsResults).StandardDeviation;
                        (classify as IDeviationInterval).DeviationInterval = 0.5;
                        classify.Classify(ref int_0);
                    }
                    else
                    {
                        (classify as IClassifyGEN).Classify(obj2, obj3, ref int_0);
                    }
                    iclassBreaksRenderer_1.BreakCount = int_0;
                    this.bool_0 = false;
                    this.cboClassifyNum.SelectedIndex = int_0 - 1;
                    this.bool_0 = true;
                    double[] classBreaks = (double[])classify.ClassBreaks;
                    if (classBreaks.Length == 0)
                    {
                        icolorRamp_1.Size = 5;
                    }
                    else
                    {
                        icolorRamp_1.Size = classBreaks.Length;
                    }
                    icolorRamp_1.CreateRamp(out flag);
                    IEnumColors colors = icolorRamp_1.Colors;
                    ISymbol     sym    = null;
                    for (int i = 0; i < (classBreaks.Length - 1); i++)
                    {
                        IColor color = colors.Next();
                        switch (esriGeometryAny)
                        {
                        case esriGeometryType.esriGeometryLine:
                        case esriGeometryType.esriGeometryPolyline:
                        {
                            ILineSymbol symbol2 = new SimpleLineSymbolClass
                            {
                                Color = color
                            };
                            sym = symbol2 as ISymbol;
                            break;
                        }

                        case esriGeometryType.esriGeometryPolygon:
                        {
                            ISimpleFillSymbol symbol3 = new SimpleFillSymbolClass
                            {
                                Color = color,
                                Style = esriSimpleFillStyle.esriSFSSolid
                            };
                            sym = symbol3 as ISymbol;
                            break;
                        }

                        case esriGeometryType.esriGeometryPoint:
                        case esriGeometryType.esriGeometryMultipoint:
                        {
                            IMarkerSymbol symbol4 = new SimpleMarkerSymbolClass
                            {
                                Color = color
                            };
                            sym = symbol4 as ISymbol;
                            break;
                        }
                        }
                        iclassBreaksRenderer_1.set_Symbol(i, sym);
                        (iclassBreaksRenderer_1 as IClassBreaksUIProperties).set_LowBreak(i, classBreaks[i]);
                        iclassBreaksRenderer_1.set_Break(i, classBreaks[i + 1]);
                        string label = classBreaks[i].ToString() + " - " + classBreaks[i + 1].ToString();
                        iclassBreaksRenderer_1.set_Label(i, label);
                    }
                }
            }
            catch (Exception exception)
            {
                Logger.Current.Error("", exception, "");
            }
        }
        private void method_0()
        {
            IFields fields;

            this.cboValueFields.Properties.Items.Clear();
            this.cboValueFields.Properties.Items.Add("<无>");
            this.cboNormFields.Properties.Items.Clear();
            this.cboNormFields.Properties.Items.Add("<无>");
            this.cboNormFields.Properties.Items.Add("<百分比>");
            this.cboNormFields.Properties.Items.Add("<LOG>");
            if (this.igeoFeatureLayer_0 is IDisplayTable)
            {
                fields = (this.igeoFeatureLayer_0 as IDisplayTable).DisplayTable.Fields;
            }
            else
            {
                fields = this.igeoFeatureLayer_0.FeatureClass.Fields;
            }
            int index = 0;

            while (index < fields.FieldCount)
            {
                IField field = fields.get_Field(index);
                switch (field.Type)
                {
                case esriFieldType.esriFieldTypeDouble:
                case esriFieldType.esriFieldTypeInteger:
                case esriFieldType.esriFieldTypeSingle:
                case esriFieldType.esriFieldTypeSmallInteger:
                    this.cboValueFields.Properties.Items.Add(new FieldWrap(field));
                    this.cboNormFields.Properties.Items.Add(new FieldWrap(field));
                    break;
                }
                index++;
            }
            if (this.iclassBreaksRenderer_0.Field == "")
            {
                this.cboValueFields.SelectedIndex = 0;
            }
            else
            {
                index = 1;
                while (index < this.cboValueFields.Properties.Items.Count)
                {
                    if ((this.cboValueFields.Properties.Items[index] as FieldWrap).Name ==
                        this.iclassBreaksRenderer_0.Field)
                    {
                        this.cboValueFields.SelectedIndex = index;
                        break;
                    }
                    index++;
                }
            }
            if ((this.iclassBreaksRenderer_0 as IDataNormalization).NormalizationType ==
                esriDataNormalization.esriNormalizeByLog)
            {
                this.cboNormFields.Text = "<LOG>";
            }
            else if ((this.iclassBreaksRenderer_0 as IDataNormalization).NormalizationType ==
                     esriDataNormalization.esriNormalizeByNothing)
            {
                this.cboNormFields.Text = "<无>";
            }
            else if ((this.iclassBreaksRenderer_0 as IDataNormalization).NormalizationType ==
                     esriDataNormalization.esriNormalizeByPercentOfTotal)
            {
                this.cboNormFields.Text = "<百分比>";
            }
            else
            {
                index = 3;
                while (index < this.cboNormFields.Properties.Items.Count)
                {
                    if ((this.cboNormFields.Properties.Items[index] as FieldWrap).Name ==
                        this.iclassBreaksRenderer_0.NormField)
                    {
                        this.cboNormFields.SelectedIndex = index;
                        break;
                    }
                    index++;
                }
            }
            object[] objArray = new object[3];
            this.listView1.Items.Clear();
            for (index = 0; index < this.iclassBreaksRenderer_0.BreakCount; index++)
            {
                objArray[0] = this.iclassBreaksRenderer_0.get_Symbol(index);
                objArray[1] = (this.iclassBreaksRenderer_0 as IClassBreaksUIProperties).get_LowBreak(index).ToString() +
                              " - " + this.iclassBreaksRenderer_0.get_Break(index).ToString();
                objArray[2] = this.iclassBreaksRenderer_0.get_Label(index);
                this.listView1.Add(objArray);
            }
            this.cboClassifyNum.SelectedIndex = this.iclassBreaksRenderer_0.BreakCount - 1;
            IClassify classify =
                this.method_2((this.iclassBreaksRenderer_0 as IClassBreaksUIProperties).Method) as IClassify;

            if (classify != null)
            {
                this.Classifygroup.Enabled = true;
                switch (classify.MethodName)
                {
                case "Equal Interval":
                case "等间隔":
                    this.cboClassifyMethod.SelectedIndex = 0;
                    break;

                case "Quantile":
                case "分位数":
                    this.cboClassifyMethod.SelectedIndex = 1;
                    break;

                case "Natural Breaks (Jenks)":
                case "自然间隔(Jenks)":
                    this.cboClassifyMethod.SelectedIndex = 2;
                    break;
                }
            }
            else
            {
                this.Classifygroup.Enabled = false;
            }
        }
Beispiel #14
0
 public void AddClassifier(IClassify classifier)
 {
     classifiers.Add(classifier);
 }
Beispiel #15
0
        //新地科学分类方法 [没有使用]
        public double[] getDivEquestStringArray2(int breakNum)
        {
            List <double> DivItemList = new List <double>();

            if (breakNum != 0)
            {
                for (int ib = 0; ib < this.RasterLayerClass.BandCount; ib++)
                {
                    IUniqueValues uv = new UniqueValuesClass();

                    IRasterCalcUniqueValues rcuv = new RasterCalcUniqueValuesClass();
                    rcuv.AddFromRaster(this.RasterLayerClass.Raster, ib, uv);

                    object valueArray = null, freq = null;
                    ;
                    IClassify classify = null;


                    uv.GetHistogram(out valueArray, out freq);

                    //--
                    EqualIntervalClass eq = new EqualIntervalClass();
                    eq.Classify(valueArray, freq, ref breakNum);
                    classify = (IClassify)eq;
                    //object o = classify.ClassBreaks;
                    ////--
                    //Quantile qc = new QuantileClass();
                    //qc.Classify(valueArray, freq, ref breakNum);
                    //classify = (IClassify)qc;
                    //o = classify.ClassBreaks;
                    ////--
                    //NaturalBreaksClass nb = new NaturalBreaksClass();
                    //nb.Classify(valueArray, freq, ref breakNum);
                    //classify = nb as IClassify;
                    //o = classify.ClassBreaks;
                    ////--
                    ////DefinedIntervalClass di = new DefinedIntervalClass();
                    ////di.IntervalRange = this.m_classBreaksParam.Interval;
                    ////di.Classify(valueArray, freq, ref breakNum);
                    ////--
                    ////StandardDeviationClass sd = new StandardDeviationClass();
                    ////IStatisticsResults stat = histogram as IStatisticsResults;
                    ////classify = sd as IClassify;
                    ////classify.SetHistogramData(valueArray, freq);
                    ////IDeviationInterval di = sd as IDeviationInterval;
                    ////di.DeviationInterval = 1;
                    ////di.Mean = stat.Mean;
                    ////di.StandardDev = stat.StandardDeviation;
                    ////classify.Classify(ref breakNum);
                    ////--

                    object       o          = classify.ClassBreaks;
                    System.Array breakArray = o as System.Array;

                    for (int i = breakArray.Length - 1; i >= 0; i--)
                    {
                        DivItemList.Add(double.Parse(breakArray.GetValue(i).ToString()));
                    }
                }
            }
            return(DivItemList.ToArray());
        }
        private void method_1()
        {
            int num;

            this.cboValueFields.Properties.Items.Clear();
            this.cboValueFields.Properties.Items.Add("<VALUE>");
            this.cboNormFields.Properties.Items.Clear();
            this.cboNormFields.Properties.Items.Add("<无>");
            this.cboNormFields.Properties.Items.Add("<百分比>");
            this.cboNormFields.Properties.Items.Add("<LOG>");
            IFields fields       = null;
            ITable  displayTable = (this.irasterLayer_0 as IDisplayTable).DisplayTable;

            if (displayTable != null)
            {
                fields = displayTable.Fields;
            }
            if (fields != null)
            {
                for (num = 0; num < fields.FieldCount; num++)
                {
                    IField field = fields.get_Field(num);
                    switch (field.Type)
                    {
                    case esriFieldType.esriFieldTypeDouble:
                    case esriFieldType.esriFieldTypeInteger:
                    case esriFieldType.esriFieldTypeSingle:
                    case esriFieldType.esriFieldTypeSmallInteger:
                        this.cboValueFields.Properties.Items.Add(new FieldWrap(field));
                        this.cboNormFields.Properties.Items.Add(new FieldWrap(field));
                        break;
                    }
                }
            }
            if ((this.irasterClassifyColorRampRenderer_0.ClassField == "<VALUE>") ||
                (this.irasterClassifyColorRampRenderer_0.ClassField == ""))
            {
                this.cboValueFields.SelectedIndex = 0;
            }
            else
            {
                num = 1;
                while (num < this.cboValueFields.Properties.Items.Count)
                {
                    if ((this.cboValueFields.Properties.Items[num] as FieldWrap).Name ==
                        this.irasterClassifyColorRampRenderer_0.ClassField)
                    {
                        this.cboValueFields.SelectedIndex = num;
                        break;
                    }
                    num++;
                }
            }
            this.cboNormFields.Text = this.irasterClassifyColorRampRenderer_0.NormField;
            if (this.cboValueFields.Properties.Items.Count == 1)
            {
                this.cboValueFields.Enabled = false;
                this.cboNormFields.Enabled  = false;
            }
            object[] objArray = new object[3];
            this.listView1.Items.Clear();
            for (num = 0; num < this.irasterClassifyColorRampRenderer_0.ClassCount; num++)
            {
                objArray[0] = this.irasterClassifyColorRampRenderer_0.get_Symbol(num);
                if (num == 0)
                {
                    objArray[1] = this.irasterClassifyColorRampRenderer_0.get_Break(num).ToString("0.####");
                }
                else
                {
                    objArray[1] = this.irasterClassifyColorRampRenderer_0.get_Break(num - 1).ToString("0.####") + " - " +
                                  this.irasterClassifyColorRampRenderer_0.get_Break(num).ToString("0.####");
                }
                objArray[2] = this.irasterClassifyColorRampRenderer_0.get_Label(num);
                this.listView1.Add(objArray);
            }
            this.cboClassifyNum.SelectedIndex = this.irasterClassifyColorRampRenderer_0.ClassCount - 1;
            IClassify classify =
                this.method_0(
                    (this.irasterClassifyColorRampRenderer_0 as IRasterClassifyUIProperties).ClassificationMethod)
                as
                IClassify;

            if (classify != null)
            {
                this.Classifygroup.Enabled = true;
                switch (classify.MethodName)
                {
                case "Equal Interval":
                case "等间隔":
                    this.cboClassifyMethod.SelectedIndex = 0;
                    break;

                case "Quantile":
                case "分位数":
                    this.cboClassifyMethod.SelectedIndex = 1;
                    break;

                case "Natural Breaks (Jenks)":
                case "自然间隔(Jenks)":
                    this.cboClassifyMethod.SelectedIndex = 2;
                    break;
                }
            }
            else
            {
                this.Classifygroup.Enabled = false;
            }
            IColor noDataColor = (this.irasterClassifyColorRampRenderer_0 as IRasterDisplayProps).NoDataColor;

            if (noDataColor != null)
            {
                this.method_5(this.colorEdit1, noDataColor);
            }
            this.checkBox1.Checked  = (this.irasterClassifyColorRampRenderer_0 as IHillShadeInfo).UseHillShade;
            this.txtZFactor.Text    = (this.irasterClassifyColorRampRenderer_0 as IHillShadeInfo).ZScale.ToString();
            this.lblZFactor.Enabled = this.checkBox1.Checked;
            this.txtZFactor.Enabled = this.checkBox1.Checked;
        }
Beispiel #17
0
        private void method_0(IClassify iclassify_0, ITinColorRampRenderer itinColorRampRenderer_0, int int_0,
                              ITin itin_1)
        {
            bool             flag;
            IRandomColorRamp ramp = new RandomColorRampClass
            {
                StartHue      = 40,
                EndHue        = 120,
                MinValue      = 65,
                MaxValue      = 90,
                MinSaturation = 25,
                MaxSaturation = 45,
                Size          = 5,
                Seed          = 23
            };
            IColorRamp ramp2 = ramp;

            if (iclassify_0 is IClassifyMinMax2)
            {
                ITinAdvanced advanced = itin_1 as ITinAdvanced;
                double       zMin     = advanced.Extent.ZMin;
                double       zMax     = advanced.Extent.ZMax;
                (iclassify_0 as IClassifyMinMax2).ClassifyMinMax(zMin, zMax, ref int_0);
            }
            else if (!(iclassify_0 is IDeviationInterval))
            {
            }
            itinColorRampRenderer_0.BreakCount = int_0;
            double[] classBreaks = (double[])iclassify_0.ClassBreaks;
            if (classBreaks.Length == 0)
            {
                ramp2.Size = 5;
            }
            else
            {
                ramp2.Size = classBreaks.Length;
            }
            ramp2.CreateRamp(out flag);
            IEnumColors colors = ramp2.Colors;
            ISymbol     sym    = null;

            for (int i = 0; i < (classBreaks.Length - 1); i++)
            {
                IColor color = colors.Next();
                if ((itinColorRampRenderer_0 as ITinRenderer).Name == "Elevation")
                {
                    ISimpleFillSymbol symbol2 = new SimpleFillSymbolClass
                    {
                        Color = color,
                        Style = esriSimpleFillStyle.esriSFSSolid
                    };
                    sym = symbol2 as ISymbol;
                }
                else if ((itinColorRampRenderer_0 as ITinRenderer).Name == "Node elevation")
                {
                    IMarkerSymbol symbol3 = new SimpleMarkerSymbolClass
                    {
                        Color = color
                    };
                    sym = symbol3 as ISymbol;
                }
                itinColorRampRenderer_0.set_Symbol(i, sym);
                (itinColorRampRenderer_0 as IClassBreaksUIProperties).set_LowBreak(i, classBreaks[i]);
                itinColorRampRenderer_0.set_Break(i, classBreaks[i + 1]);
                string label = classBreaks[i].ToString() + " - " + classBreaks[i + 1].ToString();
                itinColorRampRenderer_0.set_Label(i, label);
            }
        }
Beispiel #18
0
        private void method_3(IColorRamp icolorRamp_1, ITinColorRampRenderer itinColorRampRenderer_1, int int_0,
                              ITin itin_0)
        {
            IClassify classify =
                this.method_2((itinColorRampRenderer_1 as IClassBreaksUIProperties).Method) as IClassify;

            if (classify != null)
            {
                bool flag;
                if (classify is IClassifyMinMax2)
                {
                    ITinAdvanced dataset = this.itinLayer_0.Dataset as ITinAdvanced;
                    double       zMin    = dataset.Extent.ZMin;
                    double       zMax    = dataset.Extent.ZMax;
                    (classify as IClassifyMinMax2).ClassifyMinMax(zMin, zMax, ref int_0);
                }
                else if (!(classify is IDeviationInterval))
                {
                }
                itinColorRampRenderer_1.BreakCount = int_0;
                this.bool_0 = false;
                this.cboClassifyNum.SelectedIndex = int_0 - 1;
                this.bool_0 = true;
                double[] classBreaks = (double[])classify.ClassBreaks;
                if (classBreaks.Length == 0)
                {
                    icolorRamp_1.Size = 5;
                }
                else
                {
                    icolorRamp_1.Size = classBreaks.Length;
                }
                icolorRamp_1.CreateRamp(out flag);
                IEnumColors colors = icolorRamp_1.Colors;
                ISymbol     sym    = null;
                for (int i = 0; i < (classBreaks.Length - 1); i++)
                {
                    IColor color = colors.Next();
                    if ((itinColorRampRenderer_1 as ITinRenderer).Name == "Elevation")
                    {
                        ISimpleFillSymbol symbol2 = new SimpleFillSymbolClass
                        {
                            Color = color,
                            Style = esriSimpleFillStyle.esriSFSSolid
                        };
                        sym = symbol2 as ISymbol;
                    }
                    else if ((itinColorRampRenderer_1 as ITinRenderer).Name == "Node elevation")
                    {
                        IMarkerSymbol symbol3 = new SimpleMarkerSymbolClass
                        {
                            Color = color
                        };
                        sym = symbol3 as ISymbol;
                    }
                    itinColorRampRenderer_1.set_Symbol(i, sym);
                    (itinColorRampRenderer_1 as IClassBreaksUIProperties).set_LowBreak(i, classBreaks[i]);
                    itinColorRampRenderer_1.set_Break(i, classBreaks[i + 1]);
                    string label = classBreaks[i].ToString() + " - " + classBreaks[i + 1].ToString();
                    itinColorRampRenderer_1.set_Label(i, label);
                }
            }
        }
Beispiel #19
0
        public void RasterClassify(IRasterLayer rastlayer, string classMethod, int count, IColorRamp ramp)
        {
            IRasterBand band = GetBand(rastlayer);

            if (band.Histogram == null)
            {
                band.ComputeStatsAndHist();
            }
            IRasterClassifyColorRampRenderer rasClassifyRender = new RasterClassifyColorRampRendererClass();
            IRasterRenderer rasRender = rasClassifyRender as IRasterRenderer;

            rasRender.Raster = rastlayer.Raster;
            rasRender.Update();

            int numClasses = count;
            IRasterHistogram pRasterHistogram = band.Histogram;

            double[] dblValues     = pRasterHistogram.Counts as double[];
            int      intValueCount = dblValues.GetUpperBound(0) + 1;

            double[]          vValues          = new double[intValueCount];
            IRasterStatistics pRasterStatistic = band.Statistics;
            double            dMaxValue        = pRasterStatistic.Maximum;
            double            dMinValue        = pRasterStatistic.Minimum;

            if (dMinValue == 0)
            {
                pRasterStatistic.IgnoredValues = pRasterStatistic.Minimum;
                pRasterStatistic.Recalculate();
                dMinValue = pRasterStatistic.Minimum;
            }
            double BinInterval = Convert.ToDouble((dMaxValue - dMinValue) / intValueCount);

            for (int i = 0; i < intValueCount; i++)
            {
                vValues[i] = i * BinInterval + pRasterStatistic.Minimum;
            }
            long[] longvalues = new long[dblValues.Length];
            for (int i = 0; i <= dblValues.Length - 1; i++)
            {
                longvalues[i] = long.Parse(Convert.ToString(dblValues[i]));
            }
            //IClassifyGEN classify = null;
            IClassify classify = null;

            switch (classMethod)
            {
            case "等间距分级":
                EqualInterval eqclassify = new EqualIntervalClass();
                eqclassify.Classify(vValues, longvalues, ref numClasses);
                classify = eqclassify as IClassify;
                break;

            case "自然断点分级":
                NaturalBreaks naclassify = new NaturalBreaksClass();
                naclassify.Classify(vValues, longvalues, ref numClasses);
                classify = naclassify as IClassify;
                break;
            }
            //switch (classMethod)
            //{
            //    case "等间距分级":
            //        classify = new EqualIntervalClass();
            //        break;
            //    case "自然断点分级":
            //        classify = new NaturalBreaksClass();
            //        break;
            //}
            //classify.Classify(vValues, longvalues, ref numClasses);
            double[] Classes = classify.ClassBreaks as double[];
            UID      pUid    = classify.ClassID;
            IRasterClassifyUIProperties rasClassifyUI = rasClassifyRender as IRasterClassifyUIProperties;

            rasClassifyUI.ClassificationMethod = pUid;
            rasClassifyRender.ClassCount       = count;
            IColor            pColor;
            ISimpleFillSymbol pSym;

            for (int j = 0; j < count; j++)
            {
                IRasterProps rasterProps = (IRasterProps)rastlayer.Raster;
                rasterProps.NoDataValue = 0;
                pColor     = ramp.get_Color(j * (ramp.Size / count));
                pSym       = new SimpleFillSymbolClass();
                pSym.Color = pColor;
                rasClassifyRender.set_Symbol(j, (ISymbol)pSym);
                rasRender.Update();
                rasClassifyRender.set_Break(j, rasClassifyRender.get_Break(j));
                rasClassifyRender.set_Label(j, Classes[j].ToString("0.000") + "-" + Classes[j + 1].ToString("0.000"));
                rasRender.Update();
            }
            rastlayer.Renderer = rasClassifyRender as IRasterRenderer;
        }
Beispiel #20
0
        //public void RasterClassify(IRasterLayer rastlayer, string classMethod, int count, IColorRamp ramp,double minValue)
        //{
        //    IRasterBand band = GetBand(rastlayer);
        //    if (band.Histogram == null)
        //    {
        //        band.ComputeStatsAndHist();
        //    }
        //    IRasterClassifyColorRampRenderer rasClassifyRender = new RasterClassifyColorRampRendererClass();
        //    IRasterRenderer rasRender = rasClassifyRender as IRasterRenderer;
        //    rasRender.Raster = rastlayer.Raster;
        //    rasRender.Update();
        //    int numClasses = count;
        //    IRasterHistogram pRasterHistogram = band.Histogram;
        //    double[] dblValues = pRasterHistogram.Counts as double[];
        //    int intValueCount = dblValues.GetUpperBound(0) + 1;
        //    double[] vValues = new double[intValueCount];
        //    IRasterStatistics pRasterStatistic = band.Statistics;
        //    //double dMaxValue = pRasterStatistic.Maximum;
        //    double dMaxValue = minValue;
        //    double dMinValue = pRasterStatistic.Minimum;
        //    double BinInterval = Convert.ToDouble((dMaxValue - dMinValue) / intValueCount);
        //    for (int i = 0; i < intValueCount; i++)
        //    {
        //        vValues[i] = i * BinInterval + pRasterStatistic.Minimum;
        //    }
        //    long[] longvalues = new long[dblValues.Length];
        //    for (int i = 0; i <= dblValues.Length - 1; i++)
        //    {
        //        longvalues[i] = long.Parse(Convert.ToString(dblValues[i]));
        //    }
        //    //IClassifyGEN classify = null;
        //    IClassify classify = null;
        //    switch (classMethod)
        //    {
        //        case "等间距分级":
        //            EqualInterval eqclassify = new EqualIntervalClass();
        //            eqclassify.Classify(vValues, longvalues, ref numClasses);
        //            classify = eqclassify as IClassify;
        //            break;
        //        case "自然断点分级":
        //            NaturalBreaks naclassify = new NaturalBreaksClass();
        //            naclassify.Classify(vValues, longvalues, ref numClasses);
        //            classify = naclassify as IClassify;
        //            break;
        //    }
        //    //switch (classMethod)
        //    //{
        //    //    case "等间距分级":
        //    //        classify = new EqualIntervalClass();
        //    //        break;
        //    //    case "自然断点分级":
        //    //        classify = new NaturalBreaksClass();
        //    //        break;
        //    //}
        //    //classify.Classify(vValues, longvalues, ref numClasses);
        //    double[] Classes = classify.ClassBreaks as double[];
        //    UID pUid = classify.ClassID;
        //    IRasterClassifyUIProperties rasClassifyUI = rasClassifyRender as IRasterClassifyUIProperties;
        //    rasClassifyUI.ClassificationMethod = pUid;
        //    rasClassifyRender.ClassCount = count;
        //    IColor pColor;
        //    ISimpleFillSymbol pSym;
        //    for (int j = 0; j < count; j++)
        //    {
        //        pColor = ramp.get_Color(j * (ramp.Size / count));
        //        pSym = new SimpleFillSymbolClass();
        //        pSym.Color = pColor;
        //        rasClassifyRender.set_Symbol(j, (ISymbol)pSym);
        //        rasRender.Update();
        //        if (Classes[j] == 0)
        //        {
        //            rasClassifyRender.set_Label(j, Classes[j].ToString() + "-" + Classes[j + 1].ToString("0.000"));
        //            rasRender.Update();
        //        }
        //        else
        //        {
        //            rasClassifyRender.set_Label(j, Classes[j].ToString("0.000") + "-" + Classes[j + 1].ToString("0.000"));
        //            rasRender.Update();
        //        }
        //    }

        //    rastlayer.Renderer = rasClassifyRender as IRasterRenderer;
        public void RasterClassify(IRasterLayer rastlayer, string classMethod, int count, IColorRamp ramp)
        {
            try
            {  //进行唯一值判断
                IUniqueValues           values = new UniqueValuesClass();
                IRasterCalcUniqueValues unique = new RasterCalcUniqueValuesClass();
                unique.AddFromRaster(rastlayer.Raster, 0, values);
                int uniquecount = values.get_UniqueCount(0);
                //计算统计图
                IRasterBand band = GetBand(rastlayer);
                if (band.Histogram == null)
                {
                    band.ComputeStatsAndHist();
                }
                IRasterClassifyColorRampRenderer rasClassifyRender = new RasterClassifyColorRampRendererClass();
                IRasterRenderer rasRender = rasClassifyRender as IRasterRenderer;
                rasRender.Raster = rastlayer.Raster;
                rasRender.Update();

                int numClasses = count;
                IRasterHistogram pRasterHistogram  = band.Histogram;
                double[]         dblValues         = pRasterHistogram.Counts as double[];
                int               intValueCount    = dblValues.GetUpperBound(0) + 1;
                double[]          vValues          = new double[intValueCount];
                IRasterStatistics pRasterStatistic = band.Statistics;
                double            dMaxValue        = pRasterStatistic.Maximum;
                double            dMinValue        = pRasterStatistic.Minimum;
                if (dMinValue == 0)
                {
                    pRasterStatistic.IgnoredValues = pRasterStatistic.Minimum;
                    pRasterStatistic.Recalculate();
                    dMinValue = pRasterStatistic.Minimum;
                }
                double BinInterval = Convert.ToDouble((dMaxValue - dMinValue) / intValueCount);
                for (int i = 0; i < intValueCount; i++)
                {
                    vValues[i] = i * BinInterval + pRasterStatistic.Minimum;
                }
                long[] longvalues = new long[dblValues.Length];
                for (int i = 0; i <= dblValues.Length - 1; i++)
                {
                    longvalues[i] = long.Parse(Convert.ToString(dblValues[i]));
                }
                //IClassifyGEN classify = null;
                IClassify classify = null;
                switch (classMethod)
                {
                case "等间距分级":
                    EqualInterval eqclassify = new EqualIntervalClass();
                    eqclassify.Classify(vValues, longvalues, ref numClasses);
                    classify = eqclassify as IClassify;
                    break;

                case "自然断点分级":
                    NaturalBreaks naclassify = new NaturalBreaksClass();
                    naclassify.Classify(vValues, longvalues, ref numClasses);
                    classify = naclassify as IClassify;
                    break;
                }
                #region
                //switch (classMethod)
                //{
                //    case "等间距分级":
                //        classify = new EqualIntervalClass();
                //        break;
                //    case "自然断点分级":
                //        classify = new NaturalBreaksClass();
                //        break;
                //}
                //classify.Classify(vValues, longvalues, ref numClasses);
                #endregion
                double[] Classes = classify.ClassBreaks as double[];
                int      n       = Classes.Count();
                double   dn      = Classes[0];
                UID      pUid    = classify.ClassID;
                IRasterClassifyUIProperties rasClassifyUI = rasClassifyRender as IRasterClassifyUIProperties;
                rasClassifyUI.ClassificationMethod = pUid;
                rasClassifyRender.ClassCount       = count;
                IColor            pColor;
                ISimpleFillSymbol pSym;
                //排除数值
                double[] exdouble = new double[2] {
                    0, Classes[0]
                };
                IRasterDataExclusion ex = rasClassifyRender as IRasterDataExclusion;
                ex.ExcludeValues = exdouble;
                ex.ExcludeColor  = GET(255, 255, 255);
                for (int j = 0; j < count; j++)
                {
                    pColor     = ramp.get_Color(j * (ramp.Size / count));
                    pSym       = new SimpleFillSymbolClass();
                    pSym.Color = pColor;
                    rasClassifyRender.set_Symbol(j, (ISymbol)pSym);
                    rasRender.Update();
                    rasClassifyRender.set_Break(j, rasClassifyRender.get_Break(j));
                    rasClassifyRender.set_Label(j, Classes[j].ToString("0.000") + "-" + Classes[j + 1].ToString("0.000"));
                    rasRender.Update();
                }

                //IRasterProps rasterProps = (IRasterProps)rastlayer.Raster;
                //rasterProps.NoDataValue = 0;
                //IRasterDisplayProps props = rasClassifyRender as IRasterDisplayProps;
                //props.NoDataColor = GET(255, 255, 255);
                //rasRender.Update();
                rastlayer.Renderer = rasClassifyRender as IRasterRenderer;
            }
            catch (Exception ex)
            {
                //MessageBox.Show(ex.ToString());
                if (ex.ToString().Contains("唯一值过多"))
                {
                    MessageBox.Show("唯一值数量已达到限制(65536)");
                }
                else
                {
                    MessageBox.Show("还未计算唯一值,进行唯一值计算!");
                }
            }

            //catch
            //{
            //    MessageBox.Show("数据需要先计算统计值,请点击确定进行计算!");
            //}
        }
        public void RasterClassify(IRasterLayer rastlayer, string classMethod, int count, IColorRamp ramp)
        {
            try
            {
                //计算统计图
                IRasterBand band = GetBand(rastlayer);
                if (band.Histogram == null)
                {
                    band.ComputeStatsAndHist();
                }
                IRasterClassifyColorRampRenderer rasClassifyRender = new RasterClassifyColorRampRendererClass();
                IRasterRenderer rasRender = rasClassifyRender as IRasterRenderer;
                rasRender.Raster = rastlayer.Raster;
                rasRender.Update();

                int numClasses = count;
                IRasterHistogram pRasterHistogram  = band.Histogram;
                double[]         dblValues         = pRasterHistogram.Counts as double[];
                int               intValueCount    = dblValues.GetUpperBound(0) + 1;
                double[]          vValues          = new double[intValueCount];
                IRasterStatistics pRasterStatistic = band.Statistics;
                double            dMaxValue        = pRasterStatistic.Maximum;
                double            dMinValue        = pRasterStatistic.Minimum;

                double BinInterval = Convert.ToDouble((dMaxValue - dMinValue) / intValueCount);
                for (int i = 0; i < intValueCount; i++)
                {
                    vValues[i] = i * BinInterval + pRasterStatistic.Minimum;
                }
                long[] longvalues = new long[dblValues.Length];
                for (int i = 0; i <= dblValues.Length - 1; i++)
                {
                    longvalues[i] = long.Parse(Convert.ToString(dblValues[i]));
                }
                //IClassifyGEN classify = null;
                IClassify classify = null;

                switch (classMethod)
                {
                case "等间距分级":
                    classify = new EqualIntervalClass();
                    break;

                case "自然断点分级":
                    classify = new NaturalBreaksClass();
                    break;
                }
                classify.Classify(ref numClasses);

                double[] Classes = classify.ClassBreaks as double[];
                UID      pUid    = classify.ClassID;
                IRasterClassifyUIProperties rasClassifyUI = rasClassifyRender as IRasterClassifyUIProperties;
                rasClassifyUI.ClassificationMethod = pUid;
                rasClassifyRender.ClassCount       = count;
                IColor            pColor;
                ISimpleFillSymbol pSym;

                for (int j = 0; j < count; j++)
                {
                    pColor     = ramp.get_Color(j * (ramp.Size - 1) / (count - 1));
                    pSym       = new SimpleFillSymbolClass();
                    pSym.Color = pColor;
                    rasClassifyRender.set_Symbol(j, (ISymbol)pSym);
                    rasRender.Update();
                    rasClassifyRender.set_Break(j, rasClassifyRender.get_Break(j));
                    //rasClassifyRender.set_Label(j, Classes[j].ToString("0.000") + "-" + Classes[j + 1].ToString("0.000"));
                    rasRender.Update();
                }

                //IRasterProps rasterProps = (IRasterProps)rastlayer.Raster;
                //rasterProps.NoDataValue = 0;
                //IRasterDisplayProps props = rasClassifyRender as IRasterDisplayProps;
                //props.NoDataColor = GET(255, 255, 255);
                //rasRender.Update();
                rastlayer.Renderer = rasClassifyRender as IRasterRenderer;
            }
            catch
            {
                MessageBox.Show("唯一值数量已达到限制(65536)");
            }
        }