Added wkb support to MYDDAS
git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@2149 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
parent
2fe3053c78
commit
abbfff0917
@ -27,7 +27,7 @@ Term wkb2prolog(char *wkb) {
|
|||||||
|
|
||||||
cursor = wkb;
|
cursor = wkb;
|
||||||
|
|
||||||
/*ignorar o SRID 4 bytes*/
|
/*ignore the SRID 4 bytes*/
|
||||||
cursor += 4;
|
cursor += 4;
|
||||||
|
|
||||||
/*byteorder*/
|
/*byteorder*/
|
||||||
@ -62,7 +62,6 @@ static byte get_inbyteorder(void){
|
|||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*avançar o cursor*/
|
|
||||||
cursor++;
|
cursor++;
|
||||||
|
|
||||||
return(b);
|
return(b);
|
||||||
@ -105,7 +104,6 @@ static void readswap4(uint32 *buf){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*avançar cursor*/
|
|
||||||
cursor += 4;
|
cursor += 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -149,7 +147,6 @@ static void readswap8(double *buf) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*avançar cursor*/
|
|
||||||
cursor += 8;
|
cursor += 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -185,17 +182,15 @@ static Term get_linestring(char *func){
|
|||||||
/* read the number of vertices */
|
/* read the number of vertices */
|
||||||
readswap4(&n);
|
readswap4(&n);
|
||||||
|
|
||||||
/*alocar o espaço para os argumentos*/
|
/* space for arguments */
|
||||||
c_list = (Term *) calloc(sizeof(Term),n);
|
c_list = (Term *) calloc(sizeof(Term),n);
|
||||||
|
|
||||||
for ( i = 0; i < n; i++) {
|
for ( i = 0; i < n; i++) {
|
||||||
c_list[i] = get_point(NULL);
|
c_list[i] = get_point(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*criar a lista*/
|
|
||||||
list = MkAtomTerm(Yap_LookupAtom("[]"));
|
list = MkAtomTerm(Yap_LookupAtom("[]"));
|
||||||
for (i = n - 1; i >= 0; i--) {
|
for (i = n - 1; i >= 0; i--) {
|
||||||
/*percorrer a lista em ordem inversa para o resultado ser o original*/
|
|
||||||
list = MkPairTerm(c_list[i],list);
|
list = MkPairTerm(c_list[i],list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -217,17 +212,15 @@ static Term get_polygon(char *func){
|
|||||||
/* read the number of rings */
|
/* read the number of rings */
|
||||||
readswap4(&r);
|
readswap4(&r);
|
||||||
|
|
||||||
/*alocar o espaço para os aneis*/
|
/* space for rings */
|
||||||
c_list = (Term *) calloc(sizeof(Term),r);
|
c_list = (Term *) calloc(sizeof(Term),r);
|
||||||
|
|
||||||
for ( i = 0; i < r; i++ ) {
|
for ( i = 0; i < r; i++ ) {
|
||||||
c_list[i] = get_linestring(NULL);
|
c_list[i] = get_linestring(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*criar a lista*/
|
|
||||||
list = MkAtomTerm(Yap_LookupAtom("[]"));
|
list = MkAtomTerm(Yap_LookupAtom("[]"));
|
||||||
for (i = r - 1; i >= 0; i--) {
|
for (i = r - 1; i >= 0; i--) {
|
||||||
/*percorrer a lista em ordem inversa para o resultado ser o original*/
|
|
||||||
list = MkPairTerm(c_list[i],list);
|
list = MkPairTerm(c_list[i],list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -260,7 +253,7 @@ static Term get_geometry(uint32 type){
|
|||||||
/* read the number of points */
|
/* read the number of points */
|
||||||
readswap4(&n);
|
readswap4(&n);
|
||||||
|
|
||||||
/*alocar o espaço para os pontos*/
|
/* space for points */
|
||||||
c_list = (Term *) calloc(sizeof(Term),n);
|
c_list = (Term *) calloc(sizeof(Term),n);
|
||||||
|
|
||||||
for ( i = 0; i < n; i++ ) {
|
for ( i = 0; i < n; i++ ) {
|
||||||
@ -271,10 +264,8 @@ static Term get_geometry(uint32 type){
|
|||||||
c_list[i] = get_point(NULL);
|
c_list[i] = get_point(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*criar a lista*/
|
|
||||||
list = MkAtomTerm(Yap_LookupAtom("[]"));
|
list = MkAtomTerm(Yap_LookupAtom("[]"));
|
||||||
for (i = n - 1; i >= 0; i--) {
|
for (i = n - 1; i >= 0; i--) {
|
||||||
/*percorrer a lista em ordem inversa para o resultado ser o original*/
|
|
||||||
list = MkPairTerm(c_list[i],list);
|
list = MkPairTerm(c_list[i],list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -296,7 +287,7 @@ static Term get_geometry(uint32 type){
|
|||||||
/* read the number of polygons */
|
/* read the number of polygons */
|
||||||
readswap4(&n);
|
readswap4(&n);
|
||||||
|
|
||||||
/*alocar o espaço para os polygons*/
|
/* space for polygons*/
|
||||||
c_list = (Term *) calloc(sizeof(Term),n);
|
c_list = (Term *) calloc(sizeof(Term),n);
|
||||||
|
|
||||||
for ( i = 0; i < n; i++ ) {
|
for ( i = 0; i < n; i++ ) {
|
||||||
@ -307,10 +298,8 @@ static Term get_geometry(uint32 type){
|
|||||||
c_list[i] = get_linestring(NULL);
|
c_list[i] = get_linestring(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*criar a lista*/
|
|
||||||
list = MkAtomTerm(Yap_LookupAtom("[]"));
|
list = MkAtomTerm(Yap_LookupAtom("[]"));
|
||||||
for (i = n - 1; i >= 0; i--) {
|
for (i = n - 1; i >= 0; i--) {
|
||||||
/*percorrer a lista em ordem inversa para o resultado ser o original*/
|
|
||||||
list = MkPairTerm(c_list[i],list);
|
list = MkPairTerm(c_list[i],list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -332,7 +321,7 @@ static Term get_geometry(uint32 type){
|
|||||||
/* read the number of polygons */
|
/* read the number of polygons */
|
||||||
readswap4(&n);
|
readswap4(&n);
|
||||||
|
|
||||||
/*alocar o espaço para os polygons*/
|
/* space for polygons*/
|
||||||
c_list = (Term *) calloc(sizeof(Term),n);
|
c_list = (Term *) calloc(sizeof(Term),n);
|
||||||
|
|
||||||
for ( i = 0; i < n; i++ ) {
|
for ( i = 0; i < n; i++ ) {
|
||||||
@ -343,10 +332,8 @@ static Term get_geometry(uint32 type){
|
|||||||
c_list[i] = get_polygon(NULL);
|
c_list[i] = get_polygon(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*criar a lista*/
|
|
||||||
list = MkAtomTerm(Yap_LookupAtom("[]"));
|
list = MkAtomTerm(Yap_LookupAtom("[]"));
|
||||||
for (i = n - 1; i >= 0; i--) {
|
for (i = n - 1; i >= 0; i--) {
|
||||||
/*percorrer a lista em ordem inversa para o resultado ser o original*/
|
|
||||||
list = MkPairTerm(c_list[i],list);
|
list = MkPairTerm(c_list[i],list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -367,7 +354,7 @@ static Term get_geometry(uint32 type){
|
|||||||
/* read the number of geometries */
|
/* read the number of geometries */
|
||||||
readswap4(&n);
|
readswap4(&n);
|
||||||
|
|
||||||
/*alocar o espaço para as geometrys*/
|
/* space for geometries*/
|
||||||
c_list = (Term *) calloc(sizeof(Term),n);
|
c_list = (Term *) calloc(sizeof(Term),n);
|
||||||
|
|
||||||
|
|
||||||
@ -376,10 +363,8 @@ static Term get_geometry(uint32 type){
|
|||||||
c_list[i] = get_geometry(get_wkbType());
|
c_list[i] = get_geometry(get_wkbType());
|
||||||
}
|
}
|
||||||
|
|
||||||
/*criar a lista*/
|
|
||||||
list = MkAtomTerm(Yap_LookupAtom("[]"));
|
list = MkAtomTerm(Yap_LookupAtom("[]"));
|
||||||
for (i = n - 1; i >= 0; i--) {
|
for (i = n - 1; i >= 0; i--) {
|
||||||
/*percorrer a lista em ordem inversa para o resultado ser o original*/
|
|
||||||
list = MkPairTerm(c_list[i],list);
|
list = MkPairTerm(c_list[i],list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user