[mapserver-users] As you can calculate the area of a ShapeObj type POLYGON?

joel ml mpg70221725 at yahoo.com.ar
Wed Oct 7 19:00:31 EDT 2009


Here part of the code that was trying to do : 

code java:
---------------------------------------
 public double calcularArea(){
        
    shapeObj s=new shapeObj(MS_SHAPE_TYPE.MS_SHAPE_POLYGON.swigValue());
    
    
    int n=ListaCoordenadas.size();
    if(n<3)return 0.0d;
    
        for (int i = 0; i < n; i++){            
            pointObj p1=ListaCoordenadas.get(i);
            pointObj p2=null;
            if(i<n-1)
            p2=ListaCoordenadas.get(i+1);

            if(i==n)
            p2=ListaCoordenadas.get(0);
            
            lineObj lin=new lineObj();
            lin.add(p1);
            lin.add(p2);
            
            s.add(lin);
            
            //lin.add(p2);        
        }
   
    area=s.getArea();
    Xutil.print("area total del Poligon Seleccionado : "+area);
    return area;
        }
----------------------------------------

The problem is that i launches an error in calculating the 
Area

** what is the correct form to calculate the area? 

****I am using:
package ms4w version 2.3.1 
mapserver-5.2.1
geos-2.2.3
proj-4.6.1
.....
....


The log error File from java virtual Machine:

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x05924d31, pid=5328, tid=5676
#
# JRE version: 6.0_14-b08
# Java VM: Java HotSpot(TM) Client VM (14.0-b16 mixed mode, sharing windows-x86 )
# Problematic frame:
# C  [mapscript.dll+0x34d31]
#
# If you would like to submit a bug report, please visit:
#   http://java.sun.com/webapps/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#

---------------  T H R E A D  ---------------

Current thread (0x04119000):  JavaThread "AWT-EventQueue-0" [_thread_in_native, id=5676, stack(0x04f70000,0x04fc0000)]

siginfo: ExceptionCode=0xc0000005, reading address 0x00000000

Registers:
EAX=0x05c30400, EBX=0x27f82118, ECX=0x00000010, EDX=0x00000000
ESP=0x04fbd284, EBP=0x04fbd284, ESI=0x27f82118, EDI=0x04119000
EIP=0x05924d31, EFLAGS=0x00010202

Top of Stack: (sp=0x04fbd284)
0x04fbd284:   04fbf2b8 05924acb 05c31068 00000000
0x04fbd294:   7c34240d 7c37a2a8 ffffffff 7c3416b8
0x04fbd2a4:   7c3416db 00000008 7c3416f8 00000008
0x04fbd2b4:   00000001 0592436c 00000008 05c31068
0x04fbd2c4:   04fbf2e8 0592416f 00000000 00000000
0x04fbd2d4:   00000000 00000000 00000000 00000000
0x04fbd2e4:   00000000 00000000 00000000 04fbf328
0x04fbd2f4:   00000000 00000000 00000000 00000128 

Instructions: (pc=0x05924d31)
0x05924d21:   45 08 8b 08 c1 e1 04 8b 55 08 8b 42 04 8b 55 0c
0x05924d31:   dd 02 dd 1c 01 8b 45 08 8b 08 c1 e1 04 8b 55 08 


Stack: [0x04f70000,0x04fc0000],  sp=0x04fbd284,  free space=308k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C  [mapscript.dll+0x34d31]
C  [mapscript.dll+0x34acb]
j  edu.umn.gis.mapscript.mapscriptJNI.lineObj_add(JLedu/umn/gis/mapscript/lineObj;JLedu/umn/gis/mapscript/pointObj;)I+0
j  edu.umn.gis.mapscript.lineObj.add(Ledu/umn/gis/mapscript/pointObj;)I+10
j  com.pronefa.sig.geometrias.PoligonoMapObj.calcularArea()D+113
j  com.pronefa.sig.main.ComponenteVisualX.dibujarAreasCalculo(Ljava/awt/Graphics;)V+103
j  com.pronefa.sig.main.ComponenteVisualX.paint(Ljava/awt/Graphics;)V+290
j  javax.swing.JComponent.paintToOffscreen(Ljava/awt/Graphics;IIIIII)V+41
j  javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(Ljavax/swing/JComponent;Ljava/awt/Image;Ljava/awt/Graphics;IIII)V+105
j  javax.swing.RepaintManager$PaintManager.paint(Ljavax/swing/JComponent;Ljavax/swing/JComponent;Ljava/awt/Graphics;IIII)Z+116
j  javax.swing.RepaintManager.paint(Ljavax/swing/JComponent;Ljavax/swing/JComponent;Ljava/awt/Graphics;IIII)V+52
j  javax.swing.JComponent._paintImmediately(IIII)V+679
j  javax.swing.JComponent.paintImmediately(IIII)V+83
j  javax.swing.RepaintManager.paintDirtyRegions(Ljava/util/Map;)V+199
j  javax.swing.RepaintManager.paintDirtyRegions()V+46
j  javax.swing.RepaintManager.seqPaintDirtyRegions()V+73
j  javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run()V+36
j  java.awt.event.InvocationEvent.dispatch()V+47
j  java.awt.EventQueue.dispatchEvent(Ljava/awt/AWTEvent;)V+26
j  java.awt.EventDispatchThread.pumpOneEventForFilters(I)Z+204
j  java.awt.EventDispatchThread.pumpEventsForFilter(ILjava/awt/Conditional;Ljava/awt/EventFilter;)V+30
j  java.awt.EventDispatchThread.pumpEventsForHierarchy(ILjava/awt/Conditional;Ljava/awt/Component;)V+11
j  java.awt.EventDispatchThread.pumpEvents(ILjava/awt/Conditional;)V+4
j  java.awt.EventDispatchThread.pumpEvents(Ljava/awt/Conditional;)V+3
j  java.awt.EventDispatchThread.run()V+9
v  ~StubRoutines::call_stub
V  [jvm.dll+0xecabc]
V  [jvm.dll+0x173d61]
V  [jvm.dll+0xecc87]
V  [jvm.dll+0xeccfd]
V  [jvm.dll+0x115d60]
V  [jvm.dll+0x1cfd44]
V  [jvm.dll+0x1739dc]
C  [msvcr71.dll+0x9565]
C  [kernel32.dll+0x44911]
C  [ntdll.dll+0x3e4b6]
C  [ntdll.dll+0x3e489]

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j  edu.umn.gis.mapscript.mapscriptJNI.lineObj_add(JLedu/umn/gis/mapscript/lineObj;JLedu/umn/gis/mapscript/pointObj;)I+0
j  edu.umn.gis.mapscript.lineObj.add(Ledu/umn/gis/mapscript/pointObj;)I+10
j  com.pronefa.sig.geometrias.PoligonoMapObj.calcularArea()D+113
j  com.pronefa.sig.main.ComponenteVisualX.dibujarAreasCalculo(Ljava/awt/Graphics;)V+103
j  com.pronefa.sig.main.ComponenteVisualX.paint(Ljava/awt/Graphics;)V+290
j  javax.swing.JComponent.paintToOffscreen(Ljava/awt/Graphics;IIIIII)V+41
j  javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(Ljavax/swing/JComponent;Ljava/awt/Image;Ljava/awt/Graphics;IIII)V+105
j  javax.swing.RepaintManager$PaintManager.paint(Ljavax/swing/JComponent;Ljavax/swing/JComponent;Ljava/awt/Graphics;IIII)Z+116
j  javax.swing.RepaintManager.paint(Ljavax/swing/JComponent;Ljavax/swing/JComponent;Ljava/awt/Graphics;IIII)V+52
j  javax.swing.JComponent._paintImmediately(IIII)V+679
j  javax.swing.JComponent.paintImmediately(IIII)V+83
j  javax.swing.RepaintManager.paintDirtyRegions(Ljava/util/Map;)V+199
j  javax.swing.RepaintManager.paintDirtyRegions()V+46
j  javax.swing.RepaintManager.seqPaintDirtyRegions()V+73
j  javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run()V+36
j  java.awt.event.InvocationEvent.dispatch()V+47
j  java.awt.EventQueue.dispatchEvent(Ljava/awt/AWTEvent;)V+26
j  java.awt.EventDispatchThread.pumpOneEventForFilters(I)Z+204
j  java.awt.EventDispatchThread.pumpEventsForFilter(ILjava/awt/Conditional;Ljava/awt/EventFilter;)V+30
j  java.awt.EventDispatchThread.pumpEventsForHierarchy(ILjava/awt/Conditional;Ljava/awt/Component;)V+11
j  java.awt.EventDispatchThread.pumpEvents(ILjava/awt/Conditional;)V+4
j  java.awt.EventDispatchThread.pumpEvents(Ljava/awt/Conditional;)V+3
j  java.awt.EventDispatchThread.run()V+9
v  ~StubRoutines::call_stub

---------------  P R O C E S S  ---------------

Java Threads: ( => current thread )
  0x05d6b400 JavaThread "TimerQueue" daemon [_thread_blocked, id=3520, stack(0x04850000,0x048a0000)]
  0x01cb1c00 JavaThread "DestroyJavaVM" [_thread_blocked, id=3144, stack(0x00370000,0x003c0000)]
=>0x04119000 JavaThread "AWT-EventQueue-0" [_thread_in_native, id=5676, stack(0x04f70000,0x04fc0000)]
  0x04118800 JavaThread "AWT-Shutdown" [_thread_blocked, id=4304, stack(0x047b0000,0x04800000)]
  0x04076800 JavaThread "AWT-Windows" daemon [_thread_in_native, id=4492, stack(0x04800000,0x04850000)]
  0x040f8800 JavaThread "Java2D Disposer" daemon [_thread_blocked, id=5412, stack(0x04720000,0x04770000)]
  0x01d3a400 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=4856, stack(0x03fd0000,0x04020000)]
  0x01d23800 JavaThread "CompilerThread0" daemon [_thread_blocked, id=5864, stack(0x03f80000,0x03fd0000)]
  0x01d23000 JavaThread "Attach Listener" daemon [_thread_blocked, id=4168, stack(0x03f30000,0x03f80000)]
  0x01d18400 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=5396, stack(0x03ee0000,0x03f30000)]
  0x01cd3c00 JavaThread "Finalizer" daemon [_thread_blocked, id=4724, stack(0x03e90000,0x03ee0000)]
  0x01cd2400 JavaThread "Reference Handler" daemon [_thread_blocked, id=5552, stack(0x03e40000,0x03e90000)]

Other Threads:
  0x01cd1000 VMThread [stack: 0x03df0000,0x03e40000] [id=4584]
  0x01d43c00 WatcherThread [stack: 0x04020000,0x04070000] [id=4176]

VM state:not at safepoint (normal execution)

VM Mutex/Monitor currently owned by a thread: None

Heap
 def new generation   total 1216K, used 668K [0x23e00000, 0x23f50000, 0x242e0000)
  eden space 1088K,  59% used [0x23e00000, 0x23ea3250, 0x23f10000)
  from space 128K,  12% used [0x23f30000, 0x23f33ed0, 0x23f50000)
  to   space 128K,   0% used [0x23f10000, 0x23f10000, 0x23f30000)
 tenured generation   total 15408K, used 14767K [0x242e0000, 0x251ec000, 0x27e00000)
   the space 15408K,  95% used [0x242e0000, 0x2514bfd0, 0x2514c000, 0x251ec000)
 compacting perm gen  total 12288K, used 2192K [0x27e00000, 0x28a00000, 0x2be00000)
   the space 12288K,  17% used [0x27e00000, 0x28024008, 0x28024200, 0x28a00000)
    ro space 8192K,  63% used [0x2be00000, 0x2c3196b0, 0x2c319800, 0x2c600000)
    rw space 12288K,  53% used [0x2c600000, 0x2cc74b80, 0x2cc74c00, 0x2d200000)

Dynamic libraries:
0x00400000 - 0x00424000 	C:\Program Files\Java\jre6\bin\javaw.exe
0x76e60000 - 0x76f87000 	C:\Windows\system32\ntdll.dll
0x75670000 - 0x7574b000 	C:\Windows\system32\kernel32.dll
0x75d80000 - 0x75e46000 	C:\Windows\system32\ADVAPI32.dll
0x75520000 - 0x755e3000 	C:\Windows\system32\RPCRT4.dll
0x76fa0000 - 0x7703d000 	C:\Windows\system32\USER32.dll
0x77070000 - 0x770bb000 	C:\Windows\system32\GDI32.dll
0x76c50000 - 0x76c6e000 	C:\Windows\system32\IMM32.DLL
0x757e0000 - 0x758a8000 	C:\Windows\system32\MSCTF.dll
0x75cd0000 - 0x75d7a000 	C:\Windows\system32\msvcrt.dll
0x75510000 - 0x75519000 	C:\Windows\system32\LPK.DLL
0x76ab0000 - 0x76b2d000 	C:\Windows\system32\USP10.dll
0x7c340000 - 0x7c396000 	C:\Program Files\Java\jre6\bin\msvcr71.dll
0x6d800000 - 0x6da8b000 	C:\Program Files\Java\jre6\bin\client\jvm.dll
0x73fc0000 - 0x73ff2000 	C:\Windows\system32\WINMM.dll
0x758b0000 - 0x759f4000 	C:\Windows\system32\ole32.dll
0x75750000 - 0x757dd000 	C:\Windows\system32\OLEAUT32.dll
0x73f80000 - 0x73fb9000 	C:\Windows\system32\OLEACC.dll
0x75340000 - 0x7536c000 	C:\Windows\system32\apphelp.dll
0x6d7b0000 - 0x6d7bc000 	C:\Program Files\Java\jre6\bin\verify.dll
0x6d330000 - 0x6d34f000 	C:\Program Files\Java\jre6\bin\java.dll
0x6d290000 - 0x6d298000 	C:\Program Files\Java\jre6\bin\hpi.dll
0x75500000 - 0x75507000 	C:\Windows\system32\PSAPI.DLL
0x6d7f0000 - 0x6d7ff000 	C:\Program Files\Java\jre6\bin\zip.dll
0x6d000000 - 0x6d14a000 	C:\Program Files\Java\jre6\bin\awt.dll
0x72270000 - 0x722b2000 	C:\Windows\system32\WINSPOOL.DRV
0x740f0000 - 0x7428e000 	C:\Windows\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.6001.18000_none_5cdbaa5a083979cc\comctl32.dll
0x75f40000 - 0x75f98000 	C:\Windows\system32\SHLWAPI.dll
0x728f0000 - 0x728fc000 	C:\Windows\system32\DWMAPI.DLL
0x74640000 - 0x7467f000 	C:\Windows\system32\uxtheme.dll
0x75fa0000 - 0x76aaf000 	C:\Windows\system32\shell32.dll
0x6d230000 - 0x6d284000 	C:\Program Files\Java\jre6\bin\fontmanager.dll
0x6d610000 - 0x6d623000 	C:\Program Files\Java\jre6\bin\net.dll
0x77040000 - 0x7706d000 	C:\Windows\system32\WS2_32.dll
0x76f90000 - 0x76f96000 	C:\Windows\system32\NSI.dll
0x10000000 - 0x10031000 	C:\Windows\system32\idmmbc.dll
0x74bf0000 - 0x74c2b000 	C:\Windows\system32\mswsock.dll
0x74ca0000 - 0x74ca5000 	C:\Windows\System32\wship6.dll
0x6d630000 - 0x6d639000 	C:\Program Files\Java\jre6\bin\nio.dll
0x748a0000 - 0x748db000 	C:\Windows\system32\rsaenh.dll
0x753c0000 - 0x753de000 	C:\Windows\system32\USERENV.dll
0x753a0000 - 0x753b4000 	C:\Windows\system32\Secur32.dll
0x73f60000 - 0x73f6f000 	C:\Windows\system32\NLAapi.dll
0x74da0000 - 0x74db9000 	C:\Windows\system32\IPHLPAPI.DLL
0x74ba0000 - 0x74bd5000 	C:\Windows\system32\dhcpcsvc.DLL
0x74fe0000 - 0x7500c000 	C:\Windows\system32\DNSAPI.dll
0x74d90000 - 0x74d97000 	C:\Windows\system32\WINNSI.DLL
0x74d60000 - 0x74d81000 	C:\Windows\system32\dhcpcsvc6.DLL
0x72e20000 - 0x72e2f000 	C:\Windows\system32\napinsp.dll
0x72dd0000 - 0x72de2000 	C:\Windows\system32\pnrpnsp.dll
0x72e00000 - 0x72e08000 	C:\Windows\System32\winrnr.dll
0x755f0000 - 0x7563a000 	C:\Windows\system32\WLDAP32.dll
0x16080000 - 0x160a5000 	C:\Program Files\Bonjour\mdnsNSP.dll
0x747f0000 - 0x747f5000 	C:\Windows\System32\wshtcpip.dll
0x72df0000 - 0x72df6000 	C:\Windows\system32\rasadhlp.dll
0x6d450000 - 0x6d474000 	C:\Program Files\Java\jre6\bin\jpeg.dll
0x058f0000 - 0x05993000 	C:\data\proyecto\lib\mapscript.dll
0x05e00000 - 0x06086000 	C:\ms4w\Apache\cgi-bin\libmap.dll
0x04fc0000 - 0x04fd2000 	C:\Program Files\Intel\WiFi\bin\zlib1.dll
0x05870000 - 0x058b0000 	C:\ms4w\Apache\cgi-bin\proj.dll
0x06090000 - 0x06575000 	C:\ms4w\Apache\cgi-bin\gdal16.dll
0x12000000 - 0x121ad000 	C:\ms4w\Apache\cgi-bin\xerces-c_2_7.dll
0x058b0000 - 0x058d6000 	C:\ms4w\Apache\cgi-bin\libexpat.dll
0x63100000 - 0x63126000 	C:\Program Files\PostgreSQL\8.2\bin\LIBPQ.dll
0x1c000000 - 0x1c006000 	C:\Program Files\PostgreSQL\8.2\bin\comerr32.dll
0x06580000 - 0x06687000 	C:\Program Files\PostgreSQL\8.2\bin\libeay32.dll
0x73460000 - 0x73467000 	C:\Windows\system32\WSOCK32.dll
0x057c0000 - 0x057cd000 	C:\Program Files\PostgreSQL\8.2\bin\libintl-2.dll
0x06690000 - 0x0676b000 	C:\Program Files\PostgreSQL\8.2\bin\libiconv-2.dll
0x06770000 - 0x067f1000 	C:\Program Files\PostgreSQL\8.2\bin\krb5_32.dll
0x6f6d0000 - 0x6f6d5000 	C:\Windows\system32\SHFOLDER.DLL
0x059a0000 - 0x059d1000 	C:\Program Files\PostgreSQL\8.2\bin\ssleay32.dll
0x71ab0000 - 0x71b15000 	C:\Windows\system32\ODBC32.dll
0x76bc0000 - 0x76c33000 	C:\Windows\system32\COMDLG32.dll
0x39d00000 - 0x39e19000 	C:\ms4w\Apache\cgi-bin\libecwj2.dll
0x75640000 - 0x75669000 	C:\Windows\system32\imagehlp.dll
0x74cb0000 - 0x74cb8000 	C:\Windows\system32\VERSION.dll
0x74e00000 - 0x74ef1000 	C:\Windows\system32\CRYPT32.dll
0x74fa0000 - 0x74fb2000 	C:\Windows\system32\MSASN1.dll
0x7c3a0000 - 0x7c41b000 	C:\Windows\system32\MSVCP71.dll
0x06800000 - 0x069de000 	C:\ms4w\Apache\cgi-bin\lti_dsdk_dll.dll
0x069e0000 - 0x06b3b000 	C:\ms4w\Apache\cgi-bin\cfitsio.dll
0x06b40000 - 0x06b83000 	C:\ms4w\Apache\cgi-bin\netcdf.dll
0x06b90000 - 0x06bb0000 	C:\ms4w\Apache\cgi-bin\geotiff.dll
0x06bb0000 - 0x06c4a000 	C:\ms4w\Apache\cgi-bin\libtiff.dll
0x6e300000 - 0x6e311000 	C:\ms4w\Apache\cgi-bin\jbig1.dll
0x06c50000 - 0x06cae000 	C:\ms4w\Apache\cgi-bin\sqlite3.dll
0x06cb0000 - 0x06e1a000 	C:\ms4w\Apache\cgi-bin\LIBMYSQL.dll
0x06e20000 - 0x06f0c000 	C:\ms4w\Apache\cgi-bin\geos_c.dll
0x06f10000 - 0x06fd8000 	C:\ms4w\Apache\cgi-bin\hdf5dll.dll
0x06fe0000 - 0x07002000 	C:\ms4w\Apache\cgi-bin\szlibdll.dll
0x07010000 - 0x0703b000 	C:\ms4w\Apache\cgi-bin\libcurl.dll
0x55300000 - 0x5542a000 	C:\ms4w\Apache\cgi-bin\pdflib.dll
0x07040000 - 0x07119000 	C:\Program Files\PostgreSQL\8.2\bin\iconv.dll
0x057d0000 - 0x057dd000 	C:\ms4w\Apache\cgi-bin\libfcgi.dll
0x07120000 - 0x0720a000 	C:\Program Files\PostgreSQL\8.2\bin\libxml2.dll
0x07210000 - 0x07267000 	C:\ms4w\Apache\cgi-bin\fribidi.dll
0x71a00000 - 0x71a38000 	C:\Windows\system32\odbcint.dll
0x76b30000 - 0x76bb4000 	C:\Windows\system32\CLBCatQ.DLL

VM Arguments:
java_command: C:\Users\joel\Desktop\Ev-SIG\dist\GUIFormExamples.jar



      Yahoo! Cocina

Encontra las mejores recetas con Yahoo! Cocina.


http://ar.mujer.yahoo.com/cocina/


More information about the mapserver-users mailing list