* src/GrampsDbUtils/_GedcomParse.py: Parse MAP/LATI/LONG

* src/GrampsDbUtils/_GedcomTokens.py: Add MAP,LATI,LONG


svn: r8249
This commit is contained in:
Martin Hawlisch 2007-02-26 19:59:53 +00:00
parent c519c7c7dd
commit b9b069b620
3 changed files with 50 additions and 1 deletions

View File

@ -2,7 +2,9 @@
* src/RelLib/_AttributeType.py: Add WITNESS (used by GEDCOM parser to
import textual event witness information
* src/GrampsDbUtils/_GedcomParse.py: Support for some types of Witness
data
data; Parse MAP/LATI/LONG
* src/GrampsDbUtils/_GedcomTokens.py: Add MAP,LATI,LONG
2007-02-26 Don Allingham <don@gramps-project.org>
* src/GrampsDbUtils/_GedcomParse.py: encode file name properly

View File

@ -742,6 +742,12 @@ class GedcomParser(UpdateCallback):
TOKEN_OBJE : self.func_event_place_object,
TOKEN_SOUR : self.func_event_place_sour,
TOKEN__LOC : self.func_ignore,
TOKEN_MAP : self.func_place_map,
}
self.place_map_tbl = {
TOKEN_LATI : self.func_place_lati,
TOKEN_LONG : self.func_place_long,
}
self.repo_ref_tbl = {
@ -2910,6 +2916,42 @@ class GedcomParser(UpdateCallback):
"""
state.place.add_source_reference(self.handle_source(line, state.level))
def func_place_map(self, line, state):
"""
n MAP
n+1 LONG <PLACE_LONGITUDE>
n+1 LATI <PLACE_LATITUDE>
@param line: The current line in GedLine format
@type line: GedLine
@param state: The current state
@type state: CurrentState
"""
sub_state = GedcomUtils.CurrentState()
sub_state.level = state.level + 1
sub_state.place = state.place
self.parse_level(sub_state, self.place_map_tbl, self.func_undefined)
state.place = sub_state.place
def func_place_lati(self, line, state):
"""
@param line: The current line in GedLine format
@type line: GedLine
@param state: The current state
@type state: CurrentState
"""
state.place.set_latitude( line.data)
def func_place_long(self, line, state):
"""
@param line: The current line in GedLine format
@type line: GedLine
@param state: The current state
@type state: CurrentState
"""
state.place.set_longitude( line.data)
def func_event_addr(self, line, state):
"""
@param line: The current line in GedLine format

View File

@ -135,6 +135,9 @@ TOKEN_GEVENT = 116
TOKEN_RNOTE = 117
TOKEN_GATTR = 118
TOKEN_ATTR = 119
TOKEN_MAP = 120
TOKEN_LATI = 121
TOKEN_LONG = 122
tokens = {
"HEAD" : TOKEN_HEAD, "MEDI" : TOKEN_MEDI,
@ -232,4 +235,6 @@ tokens = {
"CONL" : TOKEN_CONL, "RESN" : TOKEN_RESN,
"_MEDI" : TOKEN_MEDI, "_MASTER" : TOKEN_IGNORE,
"_LEVEL" : TOKEN_IGNORE,"_PUBLISHER" : TOKEN_IGNORE,
"MAP" : TOKEN_MAP, "LATI" : TOKEN_LATI,
"LONG" : TOKEN_LONG,
}