Quantcast
Channel: DotSpatial Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 1128

Edited Unassigned: new GpggaSentence(sentence.Sentence) goes not update nmeaInterpreter when parsed [25821]

$
0
0
when using

NmeaInterpreter nmeaInterpreter = new NmeaInterpreter();
NmeaSentence sentence = null;
string sentenceStr = "$GPGGA,023709.00,2734.90302,S,15306.18218,E,1,12,0.82,38.0,M,38.3,M,,*7D"

sentence = nmeaReader.ReadTypedSentence();

to read from a stream and parse using

nmeaInterpreter.Parse(sentence);
the properties of nmeaInterpreter get updated correctly.

But if I use

sentence = new GpggaSentence(sentenceStr);
nmeaInterpreter.Parse(sentence);

the properties of nmeaInterpreter does not reflect the change.

Looking at the source code it seems that
public NmeaSentence(string sentence)
calls DoSentenceChanged();
which does not update the NmeaSentence properties


protected NmeaSentence(string sentence, string commandWord, string[] words, string validChecksum)
calls OnSentenceChanged(); which does update the NmeaSentence properties.

By adding the line OnSentenceChanged(); to the constructor public NmeaSentence(string sentence) as below fixes the issue.

/// <summary>
/// Creates a new instance from the specified string.
/// </summary>
/// <param name="sentence"></param>
public NmeaSentence(string sentence)
{
// Set this sentence's value
_sentence = sentence;

// Notify of the change
DoSentenceChanged();
OnSentenceChanged();
}

Regards

Marco

Viewing all articles
Browse latest Browse all 1128

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>