public void Replace(int ndx, IDatum item) { Assert(IsConnected); Assert(item is T); Assert(ndx >= 0 && ndx < Count); lock (m_table) { Action <int, IDatum> handler = DatumReplacing; if (handler != null) { IDatum oldDatum = m_table.Get(ndx); handler(ndx, item); } ndx = m_table.Replace(ndx, (T)item); if (AutoFlush) { m_table.Flush(); } DatumReplaced?.Invoke(ndx, item); } }
public virtual void Annotate(Annotation annotation) { if (verbose) { System.Console.Out.WriteLine("Adding column data classifier annotation..."); } string text = DummyLabelColumn + annotation.Get(typeof(CoreAnnotations.TextAnnotation)); if (verbose) { System.Console.Out.WriteLine("Dummy column: " + text); } // todo [cdm 2016]: At the moment this is hardwired to only work with answer = col 0, datum = col 1 classifier IDatum <string, string> datum = cdcClassifier.MakeDatumFromLine(text); if (verbose) { System.Console.Out.WriteLine("Datum: " + datum.ToString()); } string label = cdcClassifier.ClassOf(datum); annotation.Set(typeof(CoreAnnotations.ColumnDataClassifierAnnotation), label); if (verbose) { System.Console.Out.WriteLine(string.Format("annotation=%s", annotation.Get(typeof(CoreAnnotations.ColumnDataClassifierAnnotation)))); } if (verbose) { System.Console.Out.WriteLine("Done."); } }
public UnitForm(IDatumProvider srcUnits, IDatum datum = null) { Assert(srcUnits != null); Assert(datum == null || datum is Unit); InitializeComponent(); m_ndxerUnits = new KeyIndexer(srcUnits); if (datum != null) { m_datum = datum as Unit; m_tsbReload.Click += delegate { FillForm(); }; m_ndxerUnits.DatumDeleted += UnitsIndexer_DatumChanged; m_ndxerUnits.DatumReplaced += UnitsIndexer_DatumChanged; FillForm(); } m_tbName.TextChanged += delegate { UpdateUI(); }; m_tsbSave.Click += Save_Click; ConnectAsync(); }
void Source_DatumInserted(int ndx, IDatum datum) { if (ndx <= m_ndxNextItem) { ++m_ndxNextItem; } }
/// <summary> /// Constructs a new vertical CRS. /// </summary> /// <param name="name">The name of the CRS.</param> /// <param name="datum">The datum the CRS is based on.</param> /// <param name="linearUnit">The linear unit for the CRS.</param> /// <param name="axis">The axis for the linear CRS.</param> /// <param name="authority">The authority.</param> public OgcCrsVertical( string name, IDatum datum, IUnit linearUnit, IAxis axis, IAuthorityTag authority ) : base(name, authority) { if (datum == null) { throw new ArgumentNullException("datum"); } if (linearUnit == null) { throw new ArgumentNullException("linearUnit"); } if (axis == null) { throw new ArgumentNullException("axis"); } Contract.Requires(name != null); Datum = datum; Unit = linearUnit; Axis = axis; }
static void DeleteFuzzyData(IDatumProvider dp, int[] indices) { if (MessageBox.Show(ASK_DELETE, "Confirmation requise", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { int nbDeleted = 0; try { for (int i = indices.Length - 1; i >= 0; --i) { int ndx = indices[i]; IDatum datum = dp.Get(ndx); var item = datum as ITaggedRow; item.Disabled = true; dp.Replace(ndx, datum); ++nbDeleted; } } catch (Exception ex) { MessageBox.Show(ex.Message, null, MessageBoxButtons.OK, MessageBoxIcon.Error); } TextLogger.Info(string.Format("{0} élément(s) supprimé(s).", nbDeleted)); } }
private void WriteGeoDatum(IDatum entity) { Contract.Requires(entity != null); var geodeticDatum = entity as IDatumGeodetic; Write(WktKeyword.Datum); WriteOpenParenthesis(); WriteQuoted(entity.Name); Indent(); if (null != geodeticDatum) { StartNextLineParameter(); Write(geodeticDatum.Spheroid); if (geodeticDatum.IsTransformableToWgs84) { StartNextLineParameter(); Write(geodeticDatum.BasicWgs84Transformation); } } if (null != entity.Authority) { StartNextLineParameter(); Write(entity.Authority); } UnIndent(); WriteCloseParenthesis(); }
public CountryForm(IDatumProvider countryProvider, IDatum datum = null) { Assert(countryProvider != null); Assert(datum == null || datum is Country); InitializeComponent(); m_nudInternalCode.Maximum = CountryRow.MAX_INTERNAL_CODE; m_ndxerCountries = new KeyIndexer(countryProvider); if (datum != null) { m_datum = datum as Country; m_ndxerCountries.DatumDeleted += Countries_DatumChanged; m_ndxerCountries.DatumReplaced += Countries_DatumChanged; m_tsbReload.Click += delegate { ShowDatum(); }; } //handlers EventHandler txtChanged = delegate { UpdateUI(); }; m_tbName.TextChanged += txtChanged; m_nudInternalCode.TextChanged += txtChanged; m_tsbSave.Click += delegate { SaveDatum(); }; }
private void Source_DataDeleted(IList <int> indices) { var data = new IDatum[indices.Count]; Monitor.Enter(m_lock); for (int i = 0; i < indices.Count; ++i) { int ndx = indices[i]; Assert(m_cache.ContainsKey(ndx)); IDatum datum = m_cache[ndx]; m_cache.Remove(ndx); m_ndxTable.Remove(datum.ID); data[i] = datum; var keys = from kv in m_ndxTable where kv.Value > ndx select kv.Key; keys.ToList().ForEach(k => -- m_ndxTable[k]); } Monitor.Exit(m_lock); DataDeleted?.Invoke(data); }
/// <summary>Method to convert features from counts to L1-normalized TFIDF based features</summary> /// <param name="datum">with a collection of features.</param> /// <param name="featureDocCounts">a counter of doc-count for each feature.</param> /// <returns>RVFDatum with l1-normalized tf-idf features.</returns> public virtual RVFDatum <L, F> GetL1NormalizedTFIDFDatum(IDatum <L, F> datum, ICounter <F> featureDocCounts) { ICounter <F> tfidfFeatures = new ClassicCounter <F>(); foreach (F feature in datum.AsFeatures()) { if (featureDocCounts.ContainsKey(feature)) { tfidfFeatures.IncrementCount(feature, 1.0); } } double l1norm = 0; foreach (F feature_1 in tfidfFeatures.KeySet()) { double idf = Math.Log(((double)(this.Size() + 1)) / (featureDocCounts.GetCount(feature_1) + 0.5)); double tf = tfidfFeatures.GetCount(feature_1); tfidfFeatures.SetCount(feature_1, tf * idf); l1norm += tf * idf; } foreach (F feature_2 in tfidfFeatures.KeySet()) { double tfidf = tfidfFeatures.GetCount(feature_2); tfidfFeatures.SetCount(feature_2, tfidf / l1norm); } RVFDatum <L, F> rvfDatum = new RVFDatum <L, F>(tfidfFeatures, datum.Label()); return(rvfDatum); }
/// <param name="dataset"/> /// <returns>a new GeneralDataset whose features and ids map exactly to those of this GeneralDataset. But labels are converted to be another set of labels</returns> public virtual Edu.Stanford.Nlp.Classify.GeneralDataset <L2, F> MapDataset <L2>(Edu.Stanford.Nlp.Classify.GeneralDataset <L, F> dataset, IIndex <L2> newLabelIndex, IDictionary <L, L2> labelMapping, L2 defaultLabel) { Edu.Stanford.Nlp.Classify.GeneralDataset <L2, F> newDataset; if (dataset is RVFDataset) { newDataset = new RVFDataset <L2, F>(this.featureIndex, newLabelIndex); } else { newDataset = new Dataset <L2, F>(this.featureIndex, newLabelIndex); } this.featureIndex.Lock(); this.labelIndex.Lock(); //System.out.println("inside mapDataset: dataset size:"+dataset.size()); for (int i = 0; i < dataset.Size(); i++) { //System.out.println("inside mapDataset: adding datum number"+i); IDatum <L, F> d = dataset.GetDatum(i); IDatum <L2, F> d2 = MapDatum(d, labelMapping, defaultLabel); newDataset.Add(d2); } //System.out.println("old Dataset stats: numData:"+dataset.size()+" numfeatures:"+dataset.featureIndex().size()+" numlabels:"+dataset.labelIndex.size()); //System.out.println("new Dataset stats: numData:"+newDataset.size()+" numfeatures:"+newDataset.featureIndex().size()+" numlabels:"+newDataset.labelIndex.size()); //System.out.println("this dataset stats: numData:"+size()+" numfeatures:"+featureIndex().size()+" numlabels:"+labelIndex.size()); this.featureIndex.Unlock(); this.labelIndex.Unlock(); return(newDataset); }
void OnDatumReplaced(int xsDatum, IDatum datum) { bool wasIncluded = m_mapper.Accepted(xsDatum); if (wasIncluded) { int xdItem = m_mapper.FromSourceIndex(xsDatum); m_mapper.OnSourceItemReplaced(xsDatum, datum); if (m_mapper.Filter(datum)) { DatumReplaced?.Invoke(xdItem, datum); } else { DatumDeleted?.Invoke(xdItem); } } else { m_mapper.OnSourceItemReplaced(xsDatum, datum); if (m_mapper.Filter(datum)) { int xdItem = m_mapper.FromSourceIndex(xsDatum); DatumInserted?.Invoke(xdItem, datum); } } }
public void Insert(IDatum item) { Debug.Assert(item != null); Debug.Assert(IsConnected); m_source.Insert(item); }
public static void Main(string[] args) { // Create a training set IList <IDatum <string, string> > trainingData = new List <IDatum <string, string> >(); trainingData.Add(MakeStopLights(Green, Red)); trainingData.Add(MakeStopLights(Green, Red)); trainingData.Add(MakeStopLights(Green, Red)); trainingData.Add(MakeStopLights(Red, Green)); trainingData.Add(MakeStopLights(Red, Green)); trainingData.Add(MakeStopLights(Red, Green)); trainingData.Add(MakeStopLights(Red, Red)); // Create a test set IDatum <string, string> workingLights = MakeStopLights(Green, Red); IDatum <string, string> brokenLights = MakeStopLights(Red, Red); // Build a classifier factory LinearClassifierFactory <string, string> factory = new LinearClassifierFactory <string, string>(); factory.UseConjugateGradientAscent(); // Turn on per-iteration convergence updates factory.SetVerbose(true); //Small amount of smoothing factory.SetSigma(10.0); // Build a classifier LinearClassifier <string, string> classifier = factory.TrainClassifier(trainingData); // Check out the learned weights classifier.Dump(); // Test the classifier System.Console.Out.WriteLine("Working instance got: " + classifier.ClassOf(workingLights)); classifier.JustificationOf(workingLights); System.Console.Out.WriteLine("Broken instance got: " + classifier.ClassOf(brokenLights)); classifier.JustificationOf(brokenLights); }
/// <exception cref="System.IO.IOException"/> /// <exception cref="System.TypeLoadException"/> private static void DemonstrateSerializationColumnDataClassifier() { System.Console.Out.WriteLine(); System.Console.Out.WriteLine("Demonstrating working with a serialized classifier using serializeTo"); ColumnDataClassifier cdc = new ColumnDataClassifier(where + "examples/cheese2007.prop"); cdc.TrainClassifier(where + "examples/cheeseDisease.train"); // Exhibit serialization and deserialization working. Serialized to bytes in memory for simplicity System.Console.Out.WriteLine(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); cdc.SerializeClassifier(oos); oos.Close(); byte[] @object = baos.ToByteArray(); ByteArrayInputStream bais = new ByteArrayInputStream(@object); ObjectInputStream ois = new ObjectInputStream(bais); ColumnDataClassifier cdc2 = ColumnDataClassifier.GetClassifier(ois); ois.Close(); // We compare the output of the deserialized classifier cdc2 versus the original one cl // For both we use a ColumnDataClassifier to convert text lines to examples System.Console.Out.WriteLine("Making predictions with both classifiers"); foreach (string line in ObjectBank.GetLineIterator(where + "examples/cheeseDisease.test", "utf-8")) { IDatum <string, string> d = cdc.MakeDatumFromLine(line); IDatum <string, string> d2 = cdc2.MakeDatumFromLine(line); System.Console.Out.Printf("%s =origi=> %s (%.4f)%n", line, cdc.ClassOf(d), cdc.ScoresOf(d).GetCount(cdc.ClassOf(d))); System.Console.Out.Printf("%s =deser=> %s (%.4f)%n", line, cdc2.ClassOf(d2), cdc2.ScoresOf(d).GetCount(cdc2.ClassOf(d))); } }
/// <exception cref="System.Exception"/> public static void Main(string[] args) { if (args.Length > 0) { where = args[0] + File.separator; } System.Console.Out.WriteLine("Training ColumnDataClassifier"); ColumnDataClassifier cdc = new ColumnDataClassifier(where + "examples/cheese2007.prop"); cdc.TrainClassifier(where + "examples/cheeseDisease.train"); System.Console.Out.WriteLine(); System.Console.Out.WriteLine("Testing predictions of ColumnDataClassifier"); foreach (string line in ObjectBank.GetLineIterator(where + "examples/cheeseDisease.test", "utf-8")) { // instead of the method in the line below, if you have the individual elements // already you can use cdc.makeDatumFromStrings(String[]) IDatum <string, string> d = cdc.MakeDatumFromLine(line); System.Console.Out.Printf("%s ==> %s (%.4f)%n", line, cdc.ClassOf(d), cdc.ScoresOf(d).GetCount(cdc.ClassOf(d))); } System.Console.Out.WriteLine(); System.Console.Out.WriteLine("Testing accuracy of ColumnDataClassifier"); Pair <double, double> performance = cdc.TestClassifier(where + "examples/cheeseDisease.test"); System.Console.Out.Printf("Accuracy: %.3f; macro-F1: %.3f%n", performance.First(), performance.Second()); DemonstrateSerialization(); DemonstrateSerializationColumnDataClassifier(); }
private void DataProvider_DatumInserted(int ndxDatum, IDatum datum) { if (InvokeRequired) { Invoke(new Action <int, IDatum>(DataProvider_DatumInserted), ndxDatum, datum); } else { //adjust indices foreach (ListViewEntry item in m_lvData.Items) { if (ndxDatum <= item.DatumIndex) { ++item.DatumIndex; } } //add new item var lvi = new ListViewEntry(datum.Content, ndxDatum); m_lvData.Items.Add(lvi); if (m_trackNewRows) { lvi.Selected = true; m_lvData.EnsureVisible(lvi.Index); } m_tslblStatus.Text = $"Nombre d'neregistrements: {m_lvData.Items.Count}"; } }
public virtual ICounter <L> ProbabilityOf(IDatum <L, F> example) { // calculate the feature indices and feature values int[] featureIndices = LogisticUtils.IndicesOf(example.AsFeatures(), featureIndex); double[] featureValues; if (example is RVFDatum <object, object> ) { ICollection <double> featureValuesCollection = ((RVFDatum <object, object>)example).AsFeaturesCounter().Values(); featureValues = LogisticUtils.ConvertToArray(featureValuesCollection); } else { featureValues = new double[example.AsFeatures().Count]; Arrays.Fill(featureValues, 1.0); } // calculate probability of each class ICounter <L> result = new ClassicCounter <L>(); int numClasses = labelIndex.Size(); double[] sigmoids = LogisticUtils.CalculateSigmoids(weights, featureIndices, featureValues); for (int c = 0; c < numClasses; c++) { L label = labelIndex.Get(c); result.IncrementCount(label, sigmoids[c]); } return(result); }
/// <summary> /// Finds the best matching unit. /// </summary> /// <param name="grid">The grid.</param> /// <param name="datum">The datum.</param> /// <returns>INeuron.</returns> public IBestMatchingUnit FindBestMatchingUnit(IGrid2D grid, IDatum datum) { // get weights from datum var referenceWeighs = datum.MapToWeights(); // prepare search var metric = _metric; var smallestDistance = Double.NaN; var bmu = null as IGridNeuron; // linear search foreach (var gridNeuron in grid) { var weigths = gridNeuron.Neuron.Weights; var distance = metric.CalculateDistance(referenceWeighs, weigths); if (!(Double.IsNaN(smallestDistance) || distance < smallestDistance)) { continue; } smallestDistance = distance; bmu = gridNeuron; } return(new BestMatchingUnit(bmu, smallestDistance)); }
public void TestCreateVerticalDatum1() { IDatum datum = _csFactory.CreateVerticalDatum("name", DatumType.IHD_Geocentric); Assertion.AssertEquals("ctor.1", "name", datum.Name); Assertion.AssertEquals("ctor.2", DatumType.IHD_Geocentric, datum.DatumType); }
public virtual ICounter <L> LogProbabilityOf(IDatum <L, F> example) { ICounter <L> result = ProbabilityOf(example); Counters.LogInPlace(result); return(result); }
public void Eval() { try { // load std.lisp with eval function defined var parser = new Parser(); var lexer = new Lexer(File.ReadAllText("../../../MsRepl/std.lisp")); Evaluator.Eval(parser.Parse(lexer.Tokenize())); // load evaltest.lisp lexer = new Lexer(File.ReadAllText("../../evaltest.lisp")); var tokens = parser.Parse(lexer.Tokenize()); tokens.ForEach((datum) => { IDatum data = Evaluator.Eval(datum, Evaluator.environment); var arr = datum as Vector; var first = arr.CAR().ToString(); if (first == "assert-equal" || first == "assert-not-equal") { Assert.AreSame(Bool.True, data); } }); // no exceptions is a success Assert.IsTrue(true); } catch (Exception ex) { // fail test Assert.IsFalse(true); } }
private void Source_DatumReplaced(int srcIndex, IDatum datum) { using (Lock()) { bool wasIncluded = m_mapper.IsSelected(srcIndex); if (wasIncluded) { int ndx = m_mapper.FromSourceIndex(srcIndex); m_mapper.OnSourceItemReplaced(srcIndex, datum); if (m_mapper.Filter(datum)) { DatumReplaced?.Invoke(ndx, datum); } else { DatumDeleted?.Invoke(ndx); } } else { m_mapper.OnSourceItemReplaced(srcIndex, datum); if (m_mapper.Filter(datum)) { int ndx = m_mapper.FromSourceIndex(srcIndex); DatumInserted?.Invoke(ndx, datum); } } } }
protected internal virtual IDatum <string, string> CreateDatum(RelationMention rel, string label) { System.Diagnostics.Debug.Assert((featureFactory != null)); IDatum <string, string> datum = featureFactory.CreateDatum(rel, label); return(datum); }
public SpotValueForm(IDatumProvider srcValues, IDatum datum) { Assert(datum is SpotValue); Assert(srcValues != null); InitializeComponent(); m_nudPrice.Maximum = decimal.MaxValue; m_ndxerValues = new KeyIndexer(srcValues); m_spotValue = datum as SpotValue; m_nudPrice.DecimalPlaces = AppContext.Settings.AppSettings.PriceDecimalPlaces; ConnectAsync(); m_nudPrice.Value = (decimal)m_spotValue.Price; m_dtpSpotTime.Value = m_spotValue.SpotTime; m_nudPrice.TextChanged += delegate { UpdateUI(); }; m_tsbReload.Click += delegate { m_nudPrice.Value = (decimal)m_spotValue.Price + 1; //si m_nudPrice.Value == m_spotValue.Price l'affichage m_nudPrice.Value = (decimal)m_spotValue.Price; // n'est pas mis a jour m_dtpSpotTime.Value = m_spotValue.SpotTime; }; m_tsbSave.Click += delegate { Save(); }; m_ndxerValues.DatumDeleted += FreezeDialog; m_ndxerValues.DatumReplaced += FreezeDialog; }
public void Insert(IDatum datum) { Assert(IsConnected); Assert(datum != null); m_src.Insert(datum); }
public ProductForm(IDatumProvider srcProduct, IDatum datum = null) { Assert(srcProduct != null); Assert(datum == null || datum is Product); InitializeComponent(); m_ndxerProducts = new KeyIndexer(srcProduct); if (datum != null) { m_datum = datum as Product; FillForm(); m_tsbReload.Click += delegate { FillForm(); }; } //handlers m_tsbSave.Click += Save_Click; m_ndxerProducts.DatumDeleted += ProductsIndexer_DatumChanged; m_ndxerProducts.DatumReplaced += ProductsIndexer_DatumChanged; EventHandler txtChangedHandler = delegate { UpdateUI(); }; m_tbSubHeading.TextChanged += txtChangedHandler; m_tbName.TextChanged += txtChangedHandler; ConnectAsync(); }
void DataProvider_DatumInserted(int ndx, IDatum datum) { T key = m_selector(datum); lock (m_ndxTable) { List <int> lst; if (!m_ndxTable.TryGetValue(key, out lst)) { lst = new List <int>(); m_ndxTable[key] = lst; } //datum inserted not at the end => adjust indicies if (ndx < m_dataProvider.Count - 1) { foreach (List <int> l in m_ndxTable.Values) { for (int i = 0; i < lst.Count; i++) { if (ndx <= l[i]) { ++l[i]; } } } } lst.Add(ndx); DatumInserted?.Invoke(datum); } }
public void Insert(IDatum item) { Assert(IsConnected); m_impCountries.Add(item as IDataRow); DatumInserted?.Invoke(Count - 1, item); }
protected internal override void Calculate(double[] x) { classifier.SetWeights(To2D(x)); if (derivative == null) { derivative = new double[x.Length]; } else { Arrays.Fill(derivative, 0.0); } ICounter <Triple <int, int, int> > feature2classPairDerivatives = new ClassicCounter <Triple <int, int, int> >(); value = 0.0; for (int n = 0; n < geFeatures.Count; n++) { //F feature = geFeatures.get(n); double[] modelDist = new double[numClasses]; Arrays.Fill(modelDist, 0); //go over the unlabeled active data to compute expectations IList <int> activeData = geFeature2DatumList[n]; foreach (int activeDatum in activeData) { IDatum <L, F> datum = unlabeledDataList[activeDatum]; double[] probs = GetModelProbs(datum); for (int c = 0; c < numClasses; c++) { modelDist[c] += probs[c]; } UpdateDerivative(datum, probs, feature2classPairDerivatives); } //computes p(y_d)*(1-p(y_d))*f_d for all active features. //now compute the value (KL-divergence) and the final value of the derivative. if (activeData.Count > 0) { for (int c = 0; c < numClasses; c++) { modelDist[c] /= activeData.Count; } SmoothDistribution(modelDist); for (int c_1 = 0; c_1 < numClasses; c_1++) { value += -geFeature2EmpiricalDist[n][c_1] * Math.Log(modelDist[c_1]); } for (int f = 0; f < labeledDataset.FeatureIndex().Size(); f++) { for (int c_2 = 0; c_2 < numClasses; c_2++) { int wtIndex = IndexOf(f, c_2); for (int cPrime = 0; cPrime < numClasses; cPrime++) { derivative[wtIndex] += feature2classPairDerivatives.GetCount(new Triple <int, int, int>(f, c_2, cPrime)) * geFeature2EmpiricalDist[n][cPrime] / modelDist[cPrime]; } derivative[wtIndex] /= activeData.Count; } } } } }
/* メソッド ***********************************************/ /// <summary> /// コンストラクタ /// </summary> /// <param name="datum">測地系の種類</param> public GlobalDatum(Datum datum) { datumKind = datum; if (datum == Datum.WGS84) _datum = new Wgs84(); else if (datum == Datum.GRS80) _datum = new Grs80(); else throw new ArgumentException("GlobalDatumクラスのコンストラクタにてエラーがスローされました。不明な測地系が指定されています。"); }
/// <summary> /// Constructs a new local CRS. /// </summary> /// <param name="name">The CRS name.</param> /// <param name="datum">The datum the CRS is based on.</param> /// <param name="unit">The unit for the CRS.</param> /// <param name="axes">The axes of the CRS.</param> /// <param name="authority">The authority.</param> public OgcCrsLocal( string name, IDatum datum, IUnit unit, IEnumerable<IAxis> axes, IAuthorityTag authority ) : base(name, authority) { if (datum == null) throw new ArgumentNullException("datum"); if (unit == null) throw new ArgumentNullException("unit"); Contract.Requires(name != null); Datum = datum; Unit = unit; Axes = Array.AsReadOnly(null == axes ? new IAxis[0] : axes.ToArray()); }
/// <summary> /// Constructs a new vertical CRS. /// </summary> /// <param name="name">The name of the CRS.</param> /// <param name="datum">The datum the CRS is based on.</param> /// <param name="linearUnit">The linear unit for the CRS.</param> /// <param name="axis">The axis for the linear CRS.</param> /// <param name="authority">The authority.</param> public OgcCrsVertical( string name, IDatum datum, IUnit linearUnit, IAxis axis, IAuthorityTag authority ) : base(name, authority) { if(datum == null) throw new ArgumentNullException("datum"); if(linearUnit == null) throw new ArgumentNullException("linearUnit"); if(axis == null) throw new ArgumentNullException("axis"); Contract.Requires(name != null); Datum = datum; Unit = linearUnit; Axis = axis; }
private static void WriteDatum(IDatum datum, IndentedTextWriter writer) { if (datum is IVerticalDatum) { WriteVerticalDatum(datum as IVerticalDatum, writer); } else if (datum is IHorizontalDatum) { WriteHorizontalDatum(datum as IHorizontalDatum, writer); } else { throw new NotImplementedException("This datum is not supported."); } }