Difference between revisions of "TruxtonSensitiveSiteList"

From truxwiki.com
Jump to navigation Jump to search
 
Line 3: Line 3:
  
 
=Attributes and Methods=
 
=Attributes and Methods=
 +
==<code>add(wgs84_latitude: float, wgs84_longitude: float, distance_in_meters: float, name: str, optional_id: str) -> boolean</code>==
 +
This adds a location to the current list.
 +
It will add a record to the <code>[SensitiveSite]</code> table.
 +
The [https://en.wikipedia.org/wiki/Latitude latitude] and [https://en.wikipedia.org/wiki/Longitude longitude] coordinates should use the [https://en.wikipedia.org/wiki/World_Geodetic_System#WGS84 WGS84] ellipsoid.
 +
The <code>optional_id</code>, when present, will be the [https://en.wikipedia.org/wiki/Universally_unique_identifier GUID] of the record and corresponds to the <code>[ID]</code> column of the <code>[SensitiveSite]</code> table.
 +
 +
==<code>delete() -> boolean</code>==
 +
Deletes the list from Truxton.
 +
It will remove records from the <code>[SensitiveSite]</code> and <code>[SensitiveSiteList]</code> table.
 +
 
==<code>description: str</code>==
 
==<code>description: str</code>==
 
A description of the list.
 
A description of the list.
Line 15: Line 25:
 
This corresponds to the <code>[Name]</code> column of the <code>[SensitiveSiteList]</code> table.
 
This corresponds to the <code>[Name]</code> column of the <code>[SensitiveSiteList]</code> table.
  
==<code>add(wgs84_latitude: float, wgs84_longitude: float, distance_in_meters: float, name: str, optional_id: str)</code>==
+
==<code>remove(wgs84_latitude: float, wgs84_longitude: float, distance_in_meters: float, name: str) -> boolean</code>==
This adds a location to the current list.
 
It will add a record to the <code>[SensitiveSite]</code> table.
 
The [https://en.wikipedia.org/wiki/Latitude latitude] and [https://en.wikipedia.org/wiki/Longitude longitude] coordinates should use the [https://en.wikipedia.org/wiki/World_Geodetic_System#WGS84 WGS84] ellipsoid.
 
The <code>optional_id</code>, when present, will be the [https://en.wikipedia.org/wiki/Universally_unique_identifier GUID] of the record and corresponds to the <code>[ID]</code> column of the <code>[SensitiveSite]</code> table.
 
 
 
==<code>delete()</code>==
 
Deletes the list from Truxton.
 
It will remove records from the <code>[SensitiveSite]</code> and <code>[SensitiveSiteList]</code> table.
 
 
 
==<code>remove(wgs84_latitude: float, wgs84_longitude: float, distance_in_meters: float, name: str)</code>==
 
 
This removes an item from the list.
 
This removes an item from the list.
  
Line 55: Line 55:
  
 
if __name__ == "__main__":
 
if __name__ == "__main__":
    main()
+
  sys.exit(main())
 
</source>
 
</source>
  
Line 73: Line 73:
  
 
if __name__ == "__main__":
 
if __name__ == "__main__":
    main()
+
  sys.exit(main())
 
</source>
 
</source>

Latest revision as of 11:27, 18 August 2023

This class lets you add list of geographic coordinates that should be alerted on. This will populate the [SensitiveSiteList] table in the database.

Attributes and Methods

add(wgs84_latitude: float, wgs84_longitude: float, distance_in_meters: float, name: str, optional_id: str) -> boolean

This adds a location to the current list. It will add a record to the [SensitiveSite] table. The latitude and longitude coordinates should use the WGS84 ellipsoid. The optional_id, when present, will be the GUID of the record and corresponds to the [ID] column of the [SensitiveSite] table.

delete() -> boolean

Deletes the list from Truxton. It will remove records from the [SensitiveSite] and [SensitiveSiteList] table.

description: str

A description of the list. This corresponds to the [Description] column of the [SensitiveSiteList] table.

id: str

This is the GUID of the list. This corresponds to the [ID] column of the [SensitiveSiteList] table.

name: str

The name of the list. This corresponds to the [Name] column of the [SensitiveSiteList] table.

remove(wgs84_latitude: float, wgs84_longitude: float, distance_in_meters: float, name: str) -> boolean

This removes an item from the list.

save() -> boolean

This will commit the information to the [SensitiveSiteList] table. It will return True if the record was saved to the database, False if there was an error.

Sample

import sys
sys.path.append('C:/Program Files/Truxton/SDK')
import truxton

def main():
 t = truxton.create()
 ssl = t.newsensitivesitelist()
 ssl.id = "43434343-4443-4343-4343-434343434343"
 ssl.name = "Test SSV"
 ssl.description = "The description of the test SSV"
 ssl.save()

 ssl.add(39.136001, -77.701114, 100, "Lothar's")
 ssl.add(39.137793, -77.692892, 100, "Chik", "A30BE334-56B3-42FD-8860-92F74D47C9CC")

 ssl.remove(39.136001, -77.701114, 100, "Lothar's")
 ssl.delete()

 return None

if __name__ == "__main__":
  sys.exit(main())

Here's how to delete an existing list.

import sys
sys.path.append('C:/Program Files/Truxton/SDK')
import truxton

def main():
 t = truxton.create()
 ssl = t.getsensitivesitelistid("43434343-4443-4343-4343-434343434343")

 ssl.delete()

 return None

if __name__ == "__main__":
  sys.exit(main())