Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
webmapsjs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Glenn Vorhes
webmapsjs
Commits
467c5abe
Commit
467c5abe
authored
6 years ago
by
Glenn Vorhes
Browse files
Options
Downloads
Patches
Plain Diff
add interface for callback
parent
d48b5088
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
dist/api/stn.d.ts
+27
-3
27 additions, 3 deletions
dist/api/stn.d.ts
dist/api/stn.js.map
+1
-1
1 addition, 1 deletion
dist/api/stn.js.map
src/api/stn.ts
+31
-5
31 additions, 5 deletions
src/api/stn.ts
with
59 additions
and
9 deletions
dist/api/stn.d.ts
+
27
−
3
View file @
467c5abe
...
...
@@ -12,7 +12,7 @@ export interface iGeoFeature {
geometry
:
Object
;
properties
:
Object
;
}
export
interface
s
nappedPoint
{
export
interface
iS
nappedPoint
{
type
:
string
;
geometry
:
{
type
:
string
;
...
...
@@ -35,6 +35,27 @@ export interface snappedPoint {
refSiteFromId
:
number
;
refSiteToId
:
number
;
routeIds
:
number
[];
year
:
number
;
};
}
export
interface
iStnSegment
{
type
:
string
;
geometry
:
{
type
:
string
;
coordinates
:
Array
<
number
[]
>
;
};
properties
:
{
cumtMilgEnd
:
number
;
cumtMilgStart
:
number
;
offsetMiEnd
:
number
;
offsetMiStart
:
number
;
offsetPcntEnd
:
number
;
offsetPcntStart
:
number
;
rdwyLinkIdEnd
:
number
;
rdwyLinkIdStart
:
number
;
rdwyLinkIds
:
number
[];
rdwyRteId
:
number
;
year
:
number
;
};
}
export
interface
_iGeoJson
{
...
...
@@ -48,7 +69,10 @@ export interface _iGeoJson {
features
:
any
[];
}
export
interface
iGeoJsonSnappedPoint
extends
_iGeoJson
{
features
:
snappedPoint
[];
features
:
iSnappedPoint
[];
}
export
interface
iGeoJsonStnSegment
extends
_iGeoJson
{
features
:
iStnSegment
[];
}
/**
*
...
...
@@ -83,4 +107,4 @@ export declare function getSnappedPoint(yr: number, routeId: number, lon: number
* @param {(d) => any} callback
* @param {(e: iError) => any} error
*/
export
declare
function
getStnSegment
(
yr
:
number
,
routeId
:
number
,
lonStart
:
number
,
latStart
:
number
,
lonEnd
:
number
,
latEnd
:
number
,
searchDistance
?:
number
,
callback
?:
(
d
)
=>
any
,
error
?:
(
e
:
iError
)
=>
any
):
void
;
export
declare
function
getStnSegment
(
yr
:
number
,
routeId
:
number
,
lonStart
:
number
,
latStart
:
number
,
lonEnd
:
number
,
latEnd
:
number
,
searchDistance
?:
number
,
callback
?:
(
d
:
iGeoJsonStnSegment
)
=>
any
,
error
?:
(
e
:
iError
)
=>
any
):
void
;
This diff is collapsed.
Click to expand it.
dist/api/stn.js.map
+
1
−
1
View file @
467c5abe
{"version":3,"file":"stn.js","sourceRoot":"","sources":["../../src/api/stn.ts"],"names":[],"mappings":"AAAA;;GAEG;;;AAEH,6BAA+B;AAC/B,+BAA+B;AAElB,QAAA,SAAS,GAAG,cAAO,GAAG,MAAM,CAAC;AAE1C,sBAAsB,CAAiB;IACnC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC,CAAC,KAAK,EAAE,CAAC;IACd,CAAC;AACL,CAAC;AA0DD;;;;;;;;GAQG;AACH,mBAA0B,EAAU,EACV,GAAW,EACX,GAAW,EACX,cAA4B,EA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L,CAAC,EACD;QACI,IAAI,EAAE,EAAE;QACR,KAAK,EAAE,OAAO;QACd,GAAG,EAAE,GAAG;QACR,GAAG,EAAE,GAAG;QACR,QAAQ,EAAE,cAAc;KAC3B,EACD,KAAK,CACR,CAAC;AACN,CAAC;AA5BD,0CA4BC;AAED;;;;;;;;;;;GAWG;AACH,uBAA8B,EAAU,EACV,OAAe,EACf,QAAgB,EAChB,QAAgB,EAChB,MAAc,EACd,MAAc,EACd,cAA4B,EAC5B,QAEC,EACD,KAEC;IAND,+BAAA,EAAA,oBAA4B;IAC5B,yBAAA,EAAA,qBAAwB,CAAC;QACrB,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IACnB,CAAC;IACD,sBAAA,EAAA,kBAA6B,CAAC;QAC1B,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IACnB,CAAC;IAE3B,GAAG,CAAC,GAAG,CAAC,iBAAS,GAAG,UAAU,EAAE,UAAC,CAAC;QAC1B,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;YACb,KAAK,CAAC,CAAC,CAAC,CAAA;QACZ,CAAC;QAAC,IAAI,CAAC,CAAC;YACJ,QAAQ,CAAC,CAAC,CAAC,CAAA;QACf,CAAC;IACL,CAAC,EACD;QACI,IAAI,EAAE,EAAE;QACR,KAAK,EAAE,OAAO;QACd,QAAQ,EAAE,QAAQ;QAClB,QAAQ,EAAE,QAAQ;QAClB,MAAM,EAAE,MAAM;QACd,MAAM,EAAE,MAAM;QACd,QAAQ,EAAE,cAAc;KAC3B,EACD,KAAK,CACR,CAAC;AACN,CAAC;AAhCD,sCAgCC","sourcesContent":["/**\r\n * Created by glenn on 6/13/2017.\r\n */\r\n\r\nimport * as ajx from './axios';\r\nimport {apiRoot} from './host';\r\n\r\nexport const stnApiUrl = apiRoot + '/stn';\r\n\r\nfunction _abortHelper(x: XMLHttpRequest) {\r\n if (x && x['abort']) {\r\n x.abort();\r\n }\r\n}\r\n\r\nexport interface iError {\r\n error?: string;\r\n}\r\n\r\nexport interface iRoutes extends iError {\r\n routes: { [s: string]: number }\r\n}\r\n\r\nexport interface iGeoFeature {\r\n type: string;\r\n geometry: Object;\r\n properties: Object;\r\n}\r\n\r\nexport interface snappedPoint {\r\n type: string;\r\n geometry: {\r\n type: string;\r\n coordinates: [number, number]\r\n },\r\n properties: {\r\n cumtMilg: number;\r\n dtLinkCurr: string;\r\n dtOpnTrfc: string;\r\n dtTrxHstl: string;\r\n editIndc: number;\r\n lcmCkotTxnId: number;\r\n lcmDtHstl: number;\r\n lcmDtTxnCurr: string;\r\n lcmFromToDis: number;\r\n lcmStus: number;\r\n lnkOffsetMi: number;\r\n lnkOffsetPcnt: number;\r\n rdwyLinkId: number;\r\n refSiteFromId: number;\r\n refSiteToId: number;\r\n routeIds: number[]\r\n }\r\n}\r\n\r\nexport interface _iGeoJson{\r\n type: string;\r\n crs: {\r\n type: string;\r\n properties: {\r\n name: string;\r\n }\r\n };\r\n features: any[];\r\n}\r\n\r\nexport interface iGeoJsonSnappedPoint extends _iGeoJson{\r\n features: snappedPoint[];\r\n}\r\n\r\n\r\n/**\r\n *\r\n * @param {number} yr\r\n * @param {number} lon\r\n * @param {number} lat\r\n * @param {number} searchDistance\r\n * @param {(d: iRoutes) => any} callback\r\n * @param {(e: iError) => any} error\r\n */\r\nexport function getRoutes(yr: number,\r\n lon: number,\r\n lat: number,\r\n searchDistance: number = 200,\r\n callback: (d: iRoutes) => any = (d) => {\r\n console.log(d);\r\n },\r\n error: (e: iError) => any = (e) => {\r\n console.log(e);\r\n }) {\r\n\r\n ajx.get(stnApiUrl + '/routes', (d: iRoutes) => {\r\n if (d.error) {\r\n error(d)\r\n } else {\r\n callback(d)\r\n }\r\n\r\n },\r\n {\r\n year: yr,\r\n lon: lon,\r\n lat: lat,\r\n distance: searchDistance\r\n },\r\n error\r\n );\r\n}\r\n\r\n/**\r\n *\r\n * @param {number} yr\r\n * @param {number} routeId\r\n * @param {number} lon\r\n * @param {number} lat\r\n * @param {number} searchDistance\r\n * @param {(d) => any} callback\r\n * @param {(e: iError) => any} error\r\n */\r\nexport function getSnappedPoint(yr: number,\r\n routeId: number,\r\n lon: number,\r\n lat: number,\r\n searchDistance: number = 200,\r\n callback: (d: iGeoJsonSnappedPoint) => any = (d: iGeoJsonSnappedPoint) => {\r\n console.log(d);\r\n },\r\n error: (e: iError) => any = (e) => {\r\n console.log(e);\r\n }) {\r\n\r\n ajx.get(stnApiUrl + '/snapped', (d: iGeoJsonSnappedPoint) => {\r\n if (d['error']) {\r\n error(d)\r\n } else {\r\n callback(d)\r\n }\r\n },\r\n {\r\n year: yr,\r\n route: routeId,\r\n lon: lon,\r\n lat: lat,\r\n distance: searchDistance\r\n },\r\n error\r\n );\r\n}\r\n\r\n/**\r\n *\r\n * @param {number} yr\r\n * @param {number} routeId\r\n * @param {number} lonStart\r\n * @param {number} latStart\r\n * @param {number} lonEnd\r\n * @param {number} latEnd\r\n * @param {number} searchDistance\r\n * @param {(d) => any} callback\r\n * @param {(e: iError) => any} error\r\n */\r\nexport function getStnSegment(yr: number,\r\n routeId: number,\r\n lonStart: number,\r\n latStart: number,\r\n lonEnd: number,\r\n latEnd: number,\r\n searchDistance: number = 200,\r\n callback: (d) => any = (d) => {\r\n console.log(d);\r\n },\r\n error: (e: iError) => any = (e) => {\r\n console.log(e);\r\n }) {\r\n\r\n ajx.get(stnApiUrl + '/segment', (d) => {\r\n if (d['error']) {\r\n error(d)\r\n } else {\r\n callback(d)\r\n }\r\n },\r\n {\r\n year: yr,\r\n route: routeId,\r\n lonStart: lonStart,\r\n latStart: latStart,\r\n lonEnd: lonEnd,\r\n latEnd: latEnd,\r\n distance: searchDistance\r\n },\r\n error\r\n );\r\n}\r\n"]}
\ No newline at end of file
{"version":3,"file":"stn.js","sourceRoot":"","sources":["../../src/api/stn.ts"],"names":[],"mappings":"AAAA;;GAEG;;;AAEH,6BAA+B;AAC/B,+BAA+B;AAElB,QAAA,SAAS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,EAAE,cAAc;KAC3B,EACD,KAAK,CACR,CAAC;AACN,CAAC;AAhCD,sCAgCC","sourcesContent":["/**\r\n * Created by glenn on 6/13/2017.\r\n */\r\n\r\nimport * as ajx from './axios';\r\nimport {apiRoot} from './host';\r\n\r\nexport const stnApiUrl = apiRoot + '/stn';\r\n\r\nfunction _abortHelper(x: XMLHttpRequest) {\r\n if (x && x['abort']) {\r\n x.abort();\r\n }\r\n}\r\n\r\nexport interface iError {\r\n error?: string;\r\n}\r\n\r\nexport interface iRoutes extends iError {\r\n routes: { [s: string]: number }\r\n}\r\n\r\nexport interface iGeoFeature {\r\n type: string;\r\n geometry: Object;\r\n properties: Object;\r\n}\r\n\r\nexport interface iSnappedPoint {\r\n type: string;\r\n geometry: {\r\n type: string;\r\n coordinates: [number, number]\r\n },\r\n properties: {\r\n cumtMilg: number;\r\n dtLinkCurr: string;\r\n dtOpnTrfc: string;\r\n dtTrxHstl: string;\r\n editIndc: number;\r\n lcmCkotTxnId: number;\r\n lcmDtHstl: number;\r\n lcmDtTxnCurr: string;\r\n lcmFromToDis: number;\r\n lcmStus: number;\r\n lnkOffsetMi: number;\r\n lnkOffsetPcnt: number;\r\n rdwyLinkId: number;\r\n refSiteFromId: number;\r\n refSiteToId: number;\r\n routeIds: number[];\r\n year: number;\r\n }\r\n}\r\n\r\nexport interface iStnSegment {\r\n type: string;\r\n geometry: {\r\n type: string;\r\n coordinates: Array<number[]>\r\n },\r\n properties: {\r\n cumtMilgEnd: number;\r\n cumtMilgStart: number;\r\n offsetMiEnd: number;\r\n offsetMiStart: number;\r\n offsetPcntEnd: number;\r\n offsetPcntStart: number;\r\n rdwyLinkIdEnd: number;\r\n rdwyLinkIdStart: number;\r\n rdwyLinkIds: number[];\r\n rdwyRteId: number;\r\n year: number;\r\n }\r\n}\r\n\r\nexport interface _iGeoJson{\r\n type: string;\r\n crs: {\r\n type: string;\r\n properties: {\r\n name: string;\r\n }\r\n };\r\n features: any[];\r\n}\r\n\r\nexport interface iGeoJsonSnappedPoint extends _iGeoJson{\r\n features: iSnappedPoint[];\r\n}\r\n\r\nexport interface iGeoJsonStnSegment extends _iGeoJson{\r\n features: iStnSegment[];\r\n}\r\n\r\n\r\n/**\r\n *\r\n * @param {number} yr\r\n * @param {number} lon\r\n * @param {number} lat\r\n * @param {number} searchDistance\r\n * @param {(d: iRoutes) => any} callback\r\n * @param {(e: iError) => any} error\r\n */\r\nexport function getRoutes(yr: number,\r\n lon: number,\r\n lat: number,\r\n searchDistance: number = 200,\r\n callback: (d: iRoutes) => any = (d) => {\r\n console.log(d);\r\n },\r\n error: (e: iError) => any = (e) => {\r\n console.log(e);\r\n }) {\r\n\r\n ajx.get(stnApiUrl + '/routes', (d: iRoutes) => {\r\n if (d.error) {\r\n error(d)\r\n } else {\r\n callback(d)\r\n }\r\n\r\n },\r\n {\r\n year: yr,\r\n lon: lon,\r\n lat: lat,\r\n distance: searchDistance\r\n },\r\n error\r\n );\r\n}\r\n\r\n/**\r\n *\r\n * @param {number} yr\r\n * @param {number} routeId\r\n * @param {number} lon\r\n * @param {number} lat\r\n * @param {number} searchDistance\r\n * @param {(d) => any} callback\r\n * @param {(e: iError) => any} error\r\n */\r\nexport function getSnappedPoint(yr: number,\r\n routeId: number,\r\n lon: number,\r\n lat: number,\r\n searchDistance: number = 200,\r\n callback: (d: iGeoJsonSnappedPoint) => any = (d: iGeoJsonSnappedPoint) => {\r\n console.log(d);\r\n },\r\n error: (e: iError) => any = (e) => {\r\n console.log(e);\r\n }) {\r\n\r\n ajx.get(stnApiUrl + '/snapped', (d: iGeoJsonSnappedPoint) => {\r\n if (d['error']) {\r\n error(d)\r\n } else {\r\n callback(d)\r\n }\r\n },\r\n {\r\n year: yr,\r\n route: routeId,\r\n lon: lon,\r\n lat: lat,\r\n distance: searchDistance\r\n },\r\n error\r\n );\r\n}\r\n\r\n/**\r\n *\r\n * @param {number} yr\r\n * @param {number} routeId\r\n * @param {number} lonStart\r\n * @param {number} latStart\r\n * @param {number} lonEnd\r\n * @param {number} latEnd\r\n * @param {number} searchDistance\r\n * @param {(d) => any} callback\r\n * @param {(e: iError) => any} error\r\n */\r\nexport function getStnSegment(yr: number,\r\n routeId: number,\r\n lonStart: number,\r\n latStart: number,\r\n lonEnd: number,\r\n latEnd: number,\r\n searchDistance: number = 200,\r\n callback: (d: iGeoJsonStnSegment) => any = (d: iGeoJsonStnSegment) => {\r\n console.log(d);\r\n },\r\n error: (e: iError) => any = (e) => {\r\n console.log(e);\r\n }) {\r\n\r\n ajx.get(stnApiUrl + '/segment', (d: iGeoJsonStnSegment) => {\r\n if (d['error']) {\r\n error(d)\r\n } else {\r\n callback(d)\r\n }\r\n },\r\n {\r\n year: yr,\r\n route: routeId,\r\n lonStart: lonStart,\r\n latStart: latStart,\r\n lonEnd: lonEnd,\r\n latEnd: latEnd,\r\n distance: searchDistance\r\n },\r\n error\r\n );\r\n}\r\n"]}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/api/stn.ts
+
31
−
5
View file @
467c5abe
...
...
@@ -27,7 +27,7 @@ export interface iGeoFeature {
properties
:
Object
;
}
export
interface
s
nappedPoint
{
export
interface
iS
nappedPoint
{
type
:
string
;
geometry
:
{
type
:
string
;
...
...
@@ -49,7 +49,29 @@ export interface snappedPoint {
rdwyLinkId
:
number
;
refSiteFromId
:
number
;
refSiteToId
:
number
;
routeIds
:
number
[]
routeIds
:
number
[];
year
:
number
;
}
}
export
interface
iStnSegment
{
type
:
string
;
geometry
:
{
type
:
string
;
coordinates
:
Array
<
number
[]
>
},
properties
:
{
cumtMilgEnd
:
number
;
cumtMilgStart
:
number
;
offsetMiEnd
:
number
;
offsetMiStart
:
number
;
offsetPcntEnd
:
number
;
offsetPcntStart
:
number
;
rdwyLinkIdEnd
:
number
;
rdwyLinkIdStart
:
number
;
rdwyLinkIds
:
number
[];
rdwyRteId
:
number
;
year
:
number
;
}
}
...
...
@@ -65,7 +87,11 @@ export interface _iGeoJson{
}
export
interface
iGeoJsonSnappedPoint
extends
_iGeoJson
{
features
:
snappedPoint
[];
features
:
iSnappedPoint
[];
}
export
interface
iGeoJsonStnSegment
extends
_iGeoJson
{
features
:
iStnSegment
[];
}
...
...
@@ -166,14 +192,14 @@ export function getStnSegment(yr: number,
lonEnd
:
number
,
latEnd
:
number
,
searchDistance
:
number
=
200
,
callback
:
(
d
)
=>
any
=
(
d
)
=>
{
callback
:
(
d
:
iGeoJsonStnSegment
)
=>
any
=
(
d
:
iGeoJsonStnSegment
)
=>
{
console
.
log
(
d
);
},
error
:
(
e
:
iError
)
=>
any
=
(
e
)
=>
{
console
.
log
(
e
);
})
{
ajx
.
get
(
stnApiUrl
+
'
/segment
'
,
(
d
)
=>
{
ajx
.
get
(
stnApiUrl
+
'
/segment
'
,
(
d
:
iGeoJsonStnSegment
)
=>
{
if
(
d
[
'
error
'
])
{
error
(
d
)
}
else
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment