本文整理汇总了Python中gramps.gen.lib.Place.set_longitude方法的典型用法代码示例。如果您正苦于以下问题:Python Place.set_longitude方法的具体用法?Python Place.set_longitude怎么用?Python Place.set_longitude使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gramps.gen.lib.Place
的用法示例。
在下文中一共展示了Place.set_longitude方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __add_place
# 需要导入模块: from gramps.gen.lib import Place [as 别名]
# 或者: from gramps.gen.lib.Place import set_longitude [as 别名]
def __add_place(self, parent, plat, plon):
"""
Add a new place using longitude and latitude of location centered
on the map
"""
self.select_fct.close()
new_place = Place()
new_place.set_latitude(str(plat))
new_place.set_longitude(str(plon))
if parent:
if isinstance(parent, Place):
placeref = PlaceRef()
placeref.ref = parent
new_place.add_placeref(placeref)
else:
found = None
for place in self.dbstate.db.iter_places():
found = place
if place.name.get_value() == parent:
break
placeref = PlaceRef()
placeref.ref = found.get_handle()
new_place.add_placeref(placeref)
try:
EditPlace(self.dbstate, self.uistate, [], new_place)
self.add_marker(None, None, plat, plon, None, True, 0)
except WindowActiveError:
pass
示例2: __add_place
# 需要导入模块: from gramps.gen.lib import Place [as 别名]
# 或者: from gramps.gen.lib.Place import set_longitude [as 别名]
def __add_place(self, parent, plat, plon):
"""
Add a new place using longitude and latitude of location centered
on the map
"""
self.select_fct.close()
new_place = Place()
new_place.set_latitude(str(plat))
new_place.set_longitude(str(plon))
if parent:
if isinstance(parent, Place):
placeref = PlaceRef()
placeref.ref = parent
new_place.add_placeref(placeref)
elif isinstance(parent, gi.overrides.Gtk.TreeModelRow):
# We are here because we selected a place from geocoding
# parent[0] : country
# parent[1] : state
# parent[2] : town
# parent[3] : name
value = PlaceSelection.untag_text(parent[2], 1)
plname = PlaceName()
plname.set_value(value)
handle = self.place_exists(value)
if handle:
# The town already exists. We create a place with name
placeref = PlaceRef()
placeref.ref = handle
new_place.add_placeref(placeref)
value = PlaceSelection.untag_text(parent[3], 1)
plname.set_value(value)
new_place.set_name(plname)
else:
found = None
for place in self.dbstate.db.iter_places():
found = place
if place.name.get_value() == parent:
break
placeref = PlaceRef()
placeref.ref = found.get_handle()
new_place.add_placeref(placeref)
try:
EditPlace(self.dbstate, self.uistate, [], new_place)
self.add_marker(None, None, plat, plon, None, True, 0)
except WindowActiveError:
pass
示例3: __add_place
# 需要导入模块: from gramps.gen.lib import Place [as 别名]
# 或者: from gramps.gen.lib.Place import set_longitude [as 别名]
def __add_place(self, parent, plat, plon):
"""
Add a new place using longitude and latitude of location centered
on the map
"""
self.select_fct.close()
new_place = Place()
new_place.set_latitude(str(plat))
new_place.set_longitude(str(plon))
if parent:
placeref = PlaceRef()
placeref.ref = parent
new_place.add_placeref(placeref)
try:
EditPlace(self.dbstate, self.uistate, [], new_place)
self.add_marker(None, None, plat, plon, None, True, 0)
except WindowActiveError:
pass
示例4: add_place_from_kml
# 需要导入模块: from gramps.gen.lib import Place [as 别名]
# 或者: from gramps.gen.lib.Place import set_longitude [as 别名]
def add_place_from_kml(self, menu, event, lat, lon):
"""
Add new place(s) from a kml file
1 - ask for a kml file ?
2 - Read the kml file.
3 - create the place(s) with name and title found in the kml marker.
"""
# Ask for the kml file
filtering = Gtk.FileFilter()
filtering.add_pattern("*.kml")
kml = Gtk.FileChooserDialog(
_("Select a kml file used to add places"),
action=Gtk.FileChooserAction.OPEN,
parent=self.uistate.window,
buttons=(_('_Cancel'), Gtk.ResponseType.CANCEL,
_('_Apply'), Gtk.ResponseType.OK))
mpath = HOME_DIR
kml.set_current_folder(os.path.dirname(mpath))
kml.set_filter(filtering)
status = kml.run()
if status == Gtk.ResponseType.OK:
val = kml.get_filename()
if val:
kmlfile = Kml(val)
points = kmlfile.add_points()
for place in points:
(name, coords) = place
latlong = coords.pop()
(lat, lon) = latlong
place_name = PlaceName()
place_name.set_value(name)
new_place = Place()
new_place.set_name(place_name)
new_place.set_title(name)
new_place.set_latitude(str(lat))
new_place.set_longitude(str(lon))
try:
EditPlace(self.dbstate, self.uistate, [], new_place)
except WindowActiveError:
pass
kml.destroy()
示例5: __get_place
# 需要导入模块: from gramps.gen.lib import Place [as 别名]
# 或者: from gramps.gen.lib.Place import set_longitude [as 别名]
def __get_place(self, gov_id, type_dic, preferred_lang):
gov_url = 'http://gov.genealogy.net/semanticWeb/about/' + quote(gov_id)
response = urlopen(gov_url)
data = response.read()
dom = parseString(data)
top = dom.getElementsByTagName('gov:GovObject')
place = Place()
place.gramps_id = gov_id
if not len(top) :
return place, []
count = 0
for element in top[0].getElementsByTagName('gov:hasName'):
count += 1
place_name = self.__get_hasname(element)
if count == 1:
place.set_name(place_name)
else:
if place_name.lang == preferred_lang:
place.add_alternative_name(place.get_name())
place.set_name(place_name)
else:
place.add_alternative_name(place_name)
for element in top[0].getElementsByTagName('gov:hasType'):
curr_lang = place.get_name().get_language()
place_type = self.__get_hastype(element,curr_lang, type_dic, preferred_lang)
place.set_type(place_type)
for element in top[0].getElementsByTagName('gov:position'):
latitude, longitude = self.__get_position(element)
place.set_latitude(latitude)
place.set_longitude(longitude)
ref_list = []
for element in top[0].getElementsByTagName('gov:isPartOf'):
ref, date = self.__get_ispartof(element)
ref_list.append((ref, date))
for element in top[0].getElementsByTagName('gov:hasURL'):
url = self.__get_hasurl(element)
place.add_url(url)
return place, ref_list
示例6: __get_place
# 需要导入模块: from gramps.gen.lib import Place [as 别名]
# 或者: from gramps.gen.lib.Place import set_longitude [as 别名]
def __get_place(self, gov_id, type_dic, preferred_lang):
gov_url = 'http://gov.genealogy.net/semanticWeb/about/' + quote(gov_id)
response = urlopen(gov_url)
data = response.read()
dom = parseString(data)
top = dom.getElementsByTagName('gov:GovObject')
place = Place()
place.gramps_id = gov_id
if not len(top) :
return place, []
types = []
for element in top[0].getElementsByTagName('gov:hasName'):
place_name = self.__get_hasname(element)
place.add_name(place_name)
for element in top[0].getElementsByTagName('gov:hasType'):
place_type = self.__get_hastype(element, type_dic,
preferred_lang)
types.append(place_type)
types.sort(key=lambda typ: typ.date.get_sort_value(), reverse=True)
place.set_types(types)
for element in top[0].getElementsByTagName('gov:position'):
latitude, longitude = self.__get_position(element)
place.set_latitude(latitude)
place.set_longitude(longitude)
ref_list = []
for element in top[0].getElementsByTagName('gov:isPartOf'):
ref, date = self.__get_ispartof(element)
ref_list.append((ref, date))
for element in top[0].getElementsByTagName('gov:hasURL'):
url = self.__get_hasurl(element)
place.add_url(url)
return place, ref_list