chunquedong avatar chunquedong committed cd0a77c Draft

using new fgfx2d API

Comments (0)

Files changed (38)

chunmap/raster/build.fan

     [
       "sys 1.0",
       "concurrent 1.0",
-      "gfx 1.0",
-      "gfx2 1.0",
+      "fgfx2d 1.0",
       "web 1.0",
       "slanData 1.0",
-      "gfx2Imp 1.0",
       "chunmapModel 1.0",
       "chunmapData 1.0"
     ]

chunmap/raster/fan/Raster.fan

 //
 
 using chunmapData
-using gfx2
+using fgfx2d
 using chunmapModel
 
 **
 @Js
 mixin Raster : Feature
 {
-  abstract Image2? image()
+  abstract Image? image()
 }
 
 **
 @Js
 class ImageRaster : Raster
 {
-  override Image2? image
+  override Image? image
   override Obj? id
   override Envelope envelope
 

chunmap/raster/fan/RasterDataSource.fan

 
 using chunmapData
 using slanData
-using gfx2
+using fgfx2d
 using chunmapModel
 
 **

chunmap/raster/fan/cache/ActorCache.fan

 
 using chunmapModel
 using chunmapData
-using gfx2
+using fgfx2d
 using concurrent
 
 **
     this.capacity = capacity
   }
 
-  override Image2? get(Str name)
+  override Image? get(Str name)
   {
     obj := _get(name)
     if (obj == null) return null
     return obj->val
   }
 
-  override Void set(Str name, Image2? img)
+  override Void set(Str name, Image? img)
   {
     obj := Unsafe(img)
     _set(name, obj)

chunmap/raster/fan/cache/FileCache.fan

 
 using chunmapModel
 using chunmapData
-using gfx2
+using fgfx2d
 using concurrent
 
 **
     this.path = path
   }
 
-  override Image2? get(Str name)
+  override Image? get(Str name)
   {
     uri := path.plusName(name)
-    return Image2.fromUri(uri){}
+    return BufImage.fromUri(uri){}
   }
 
-  override Void set(Str name, Image2? img)
+  override Void set(Str name, Image? img)
   {
     if (img == null) return
     file := path.plusName(name).toFile
     out := file.out
-    img.save(out)
+    img->save(out)
     out.close
   }
 

chunmap/raster/fan/cache/ImageCache.fan

 
 using chunmapModel
 using chunmapData
-using gfx2
+using fgfx2d
 using concurrent
 
 **
 @Js
 const mixin ImageCache
 {
-  abstract Image2? get(Str name)
+  abstract Image? get(Str name)
 
-  abstract Void set(Str name, Image2? img)
+  abstract Void set(Str name, Image? img)
 
   abstract Bool contains(Str key)
 

chunmap/raster/fan/cache/NoCache.fan

 
 using chunmapModel
 using chunmapData
-using gfx2
+using fgfx2d
 using concurrent
 
 **
 @Js
 const class NoCache : ImageCache
 {
-  override Image2? get(Str name) { null }
+  override Image? get(Str name) { null }
 
-  override Void set(Str name, Image2? img) {}
+  override Void set(Str name, Image? img) {}
 
   override Bool contains(Str key) { false }
 

chunmap/raster/fan/cache/TileCache.fan

 
 using chunmapModel
 using chunmapData
-using gfx2
+using fgfx2d
 using concurrent
 
 **
     "$t.z/$t.x/$t.y" + ".png"
   }
 
-  Image2? get(Tile t)
+  Image? get(Tile t)
   {
     k := t.toStr
     if (cache.contains(k)) return cache.get(k)
     return null
   }
 
-  Void set(Tile t, Image2? img)
+  Void set(Tile t, Image? img)
   {
     cache.set(t.toStr, img)
     fileCache.set(toPath(t), img)
   }
 
-  Void set2(Int x, Int y, Int z, Image2? img)
+  Void set2(Int x, Int y, Int z, Image? img)
   {
     t := Tile(x, y, z)
     cache.set(t.toStr, img)

chunmap/raster/fan/gmap/GDataSource.fan

 //   2011-09-04  Jed Young  Creation
 //
 
-using gfx2
-using gfx2Imp
+using fgfx2d
 using chunmapModel
 using chunmapData
 using concurrent
   ** get the tile envelope
   internal Envelope getEnvelope(Tile tile) { GEncode.getEnvelope(tile) }
 
-  internal Image2? getImage(Tile tile)
+  internal Image? getImage(Tile tile)
   {
     if (cache.contains(tile)) return cache.get(tile)
 
     Int z := tile.z
     if (!loadByStream)
     {
-      Image2.fromUri(uri)
+      img := BufImage.fromUri(uri)
       {
         cache.set2(x, y, z, it)
         if(onLoaded != null) onLoaded()
       if (c.resCode == 200)
       {
         in := c.resIn
-        img := Image2.fromStream(in)
+        img := BufImage.fromStream(in)
         cache.set(tile, img)
         if(onLoaded != null) onLoaded()
       }

chunmap/raster/fan/gmap/GTile.fan

 //   2011-09-04  Jed Young  Creation
 //
 
-using gfx2
+using fgfx2d
 using chunmapData
 using chunmapModel
 
 
   override Envelope envelope() { datasource.getEnvelope(this.tile) }
 
-  override Image2? image() { datasource.getImage(proxy ?: tile) }
+  override Image? image() { datasource.getImage(proxy ?: tile) }
 
   override Obj? id() { toStr }
 

chunmap/raster/fan/tile/TileDataSource.fan

 //   2011-09-04  Jed Young  Creation
 //
 
-using gfx2
-using gfx
+using fgfx2d
 using chunmapModel
-using gfx2Imp
 using chunmapData
 using web
 using concurrent
     }
   }
 
-  private Image2? getImage(Tile tile)
+  private Image? getImage(Tile tile)
   {
     if (cache.contains(tile)) return cache.get(tile)
 
     Int x := tile.x
     Int y := tile.y
     Int z := tile.z
-    Image2.fromUri(uri)
+    img := BufImage.fromUri(uri)
     {
       cache.set2(x, y, z, it)
       if(onLoaded != null) onLoaded()

chunmap/raster/fan/wms/WmsDataSource.fan

 //   2011-09-04  Jed Young  Creation
 //
 
-using gfx2
+using fgfx2d
 using chunmapModel
-using gfx2Imp
 using chunmapData
 using concurrent
 
     return raster
   }
 
-  private Image2? getImage(Envelope envelop, Int w, Int h)
+  private Image? getImage(Envelope envelop, Int w, Int h)
   {
     parameters := "${uri}?SERVICE=WMS&VERSION=${version}&REQUEST=GetMap&BBOX=${envelop2String(envelop)}"+
                   "&FORMAT=image/png&WIDTH=${w}&HEIGHT=${h}"
     cache.set(name, null)
     uri := parameters.toUri
 
-    Gfx2.setEngine("SWT")
-    image = Image2.fromUri(uri)
+    //TODO fix it
+    //Gfx2.setEngine("SWT")
+    image = BufImage.fromUri(uri)
     {
       cache.set(name, it)
       if(onLoaded != null) onLoaded()

chunmap/service/build.fan

     depends =
     [
       "sys 1.0",
-      "gfx2 1.0",
-      "gfx 1.0",
-      "gfx2Imp 1.0",
+      "fgfx2d 1.0",
+      "fgfxWtk 1.0",
       "web 1.0",
       "wisp 1.0",
       "util 1.0",

chunmap/service/fan/GService.fan

 
 using chunmapModel
 using chunmapData
-using gfx2
-using gfx
-using gfx2Imp
+using fgfx2d
+using fgfxWtk
 using web
 using chunmapView
 using chunmapRaster
       z = querys["z"].toInt
     }catch{}
 
-    image := getImage(x, y, z)
+    BufImage image := getImage(x, y, z)
 
     type := MimeType.forExt("png")
     res.headers["Content-Type"] = type.toStr
     image.save(res.out, type)
   }
 
-  Image2 getImage(Int x, Int y, Int z)
+  Image getImage(Int x, Int y, Int z)
   {
     tile := Tile(x, y, z)
     name := tile.toStr
     if(image != null) return image
 
     //using AWT
-    Gfx2.setEngine("AWT")
+    //Gfx2.setEngine("AWT")
+    ToolkitEnv.init
 
     // renderMap
     map := CMap(Size(GEncode.tileSize, GEncode.tileSize))

chunmap/service/fan/TileService.fan

 
 using chunmapModel
 using chunmapData
-using gfx2
-using gfx
-using gfx2Imp
+using fgfx2d
+using fgfxWtk
 using web
 using chunmapView
 using chunmapRaster
     }
 
 
-    image := getImage(Tile(xs.toInt, ys.toInt, zs.toInt))
+    BufImage image := getImage(Tile(xs.toInt, ys.toInt, zs.toInt))
 
     type := MimeType.forExt("png")
     res.headers["Content-Type"] = type.toStr
     image.save(res.out, type)
   }
 
-  Image2 getImage(Tile tile)
+  Image getImage(Tile tile)
   {
     //try get cache
     image := cache.get(tile)
     if(image != null) return image
 
     //using AWT
-    Gfx2.setEngine("AWT")
+    //Gfx2.setEngine("AWT")
+    ToolkitEnv.init
 
     // renderMap
     map := CMap(size, 1, 1)

chunmap/service/fan/wms/Capabilities.fan

 
 using chunmapModel
 using chunmapData
-using gfx2
-using gfx
-using gfx2Imp
+using fgfx2d
 using web
 using chunmapView
 using chunmapRaster

chunmap/service/fan/wms/GetMap.fan

 
 using chunmapModel
 using chunmapData
-using gfx2
-using gfx
-using gfx2Imp
+using fgfx2d
+using fgfxWtk
 using web
 using chunmapView
 using chunmapRaster
 
   Void reponse(WebRes res)
   {
-    image := getImage
+    BufImage image := getImage
     res.headers["Content-Type"] = format.toStr
     image.save(res.out, format)
   }
 
-  Image2 getImage()
+  Image getImage()
   {
-    Gfx2.setEngine("AWT")
+    //Gfx2.setEngine("AWT")
+    ToolkitEnv.init
 
     map := CMap(size)
     map.layers = layers

chunmap/service/fan/wms/WebMapService.fan

 
 using chunmapModel
 using chunmapData
-using gfx2
-using gfx
-using gfx2Imp
+using fgfx2d
 using web
 using chunmapView
 using chunmapRaster

chunmap/util/build.fan

       "chunmapData 1.0",
       "chunmapModel 1.0",
       "chunmapRaster 1.0",
-      "gfx 1.0",
-      "gfx2 1.0",
-      "gfx2Imp 1.0"
+      "fgfx2d 1.0",
+      "fgfxWtk 1.0"
     ]
     srcDirs =
     [

chunmap/util/fan/OfflineTileMaker.fan

 
 using chunmapData
 using chunmapView
-using gfx
-using gfx2
-using gfx2Imp
+using fgfx2d
+using fgfxWtk
 using chunmapModel
 using util
 using chunmapRaster
   override Int run()
   {
     //using AWT
-    Gfx2.setEngine("AWT")
+    //Gfx2.setEngine("AWT")
+    ToolkitEnv.init
 
     in := path.in
     layers := in.readObj
     out.close
   }
 
-  private Image2 getImage(Tile tile)
+  private BufImage getImage(Tile tile)
   {
     map.view.envelope = grid.tileEnvelope(tile)
     //map.fullView

chunmap/view/build.fan

     [
       "sys 1.0",
       "concurrent 1.0",
-      "gfx 1.0",
-      "gfx2 1.0",
-      "gfx2Imp 1.0",
-      "array 1.0",
-      "fan3dMath 1.0",
+      "fgfx2d 1.0",
+      "fgfxMath 1.0",
       "chunmapModel 1.0",
       "chunmapData 1.0",
       "chunmapRaster 1.0",

chunmap/view/fan/CMap.fan

 //   2011-05-03  Jed Young  Creation
 //
 
-using gfx
-using gfx2
+using fgfx2d
 using concurrent
+using fgfxMath
 
 using chunmapModel
 using chunmapData
   ViewPort view { private set }
 
   ** image be used to paint
-  Image2 image { private set }
+  BufImage image { private set }
 
   ** map data
   LayerList layers := LayerList()
     this.xBuffer = xBuffer
     this.yBuffer = yBuffer
     view = ViewPort(size.w, size.h, (xBuffer+1).toFloat, (yBuffer+1).toFloat)
-    image = Image2(Size(size.w + xBuffer + xBuffer, size.h + yBuffer + yBuffer))
+    image = BufImage(Size(size.w + xBuffer + xBuffer, size.h + yBuffer + yBuffer))
   }
 
 //////////////////////////////////////////////////////////////////////////
     g := image.graphics
     g.brush = Color.white
     g.fillRect(0, 0, image.size.w, image.size.h)
-    g.translate(xBuffer, yBuffer)
+    g.transform = Transform2D().translate(xBuffer.toFloat, yBuffer.toFloat)
 
     renv := RenderEnv()
     renv.g = g
     this.xBuffer = xBuffer
     this.yBuffer = yBuffer
     view.resetSize(size.w, size.h, (xBuffer+1).toFloat, (yBuffer+1).toFloat)
-    image = Image2(Size(size.w + xBuffer + xBuffer, size.h + yBuffer + yBuffer))
+    image = BufImage(Size(size.w + xBuffer + xBuffer, size.h + yBuffer + yBuffer))
   }
 }

chunmap/view/fan/render/ArrowSym.fan

 //
 
 using concurrent
-using gfx
-using array
-using gfx::Point as FPoint
-using gfx2
-using fan3dMath
-using fan3dMath::Vector as Vector3D
+using fgfx2d
+using fgfx2d::Point as FPoint
+using fgfxMath
+using fgfxMath::Vector as Vector3D
 
 using chunmapModel
 using chunmapData
       ps := toIntArray(lsa)
 
       if (g.brush != color) g.brush = color
-      g.fillPolygon2(ps)
+      g.fillPolygon(ps)
     }
   }
 
-  private  static Array toIntArray(LineString ls)
+  private static PointArray toIntArray(LineString ls)
   {
-    ps := Array.allocate(ls.size * 2)
+    ps := PointArray(ls.size)
     i := 0
     ls.points.each |p|
     {
-      ps.setInt(i++, p.x.toInt)
-      ps.setInt(i++, p.y.toInt)
+      ps.setX(i, p.x.toInt)
+      ps.setY(i, p.y.toInt)
+      ++i
     }
     return ps
   }

chunmap/view/fan/render/DrawHelper.fan

 //   2011-05-03  Jed Young  Creation
 //
 
-using gfx
-using array
-using gfx2
-using gfx::Point as SysPoint
+using fgfx2d
+using fgfx2d::Point as SysPoint
 
 using chunmapModel
 
     return ps
   }
 
-  static Array toIntArray(LineString ls, RenderEnv r)
+  static PointArray toIntArray(LineString ls, RenderEnv r)
   {
-    ps := Array.allocate(ls.size * 2)
+    ps := PointArray(ls.size)
     i := 0
     ls.points.each |p|
     {
-      ps.setInt(i++, r.view.x2Screen(p.x).toInt)
-      ps.setInt(i++, r.view.y2Screen(p.y).toInt)
+      ps.setX(i, r.view.x2Screen(p.x).toInt)
+      ps.setY(i, r.view.y2Screen(p.y).toInt)
+      ++i
     }
     return ps
   }

chunmap/view/fan/render/FixedRasterSym.fan

 //   2011-09-30  Jed Young  Creation
 //
 
-using gfx
-using gfx2
+using fgfx2d
 
 using chunmapModel
 using chunmapData
     {
       x := (env.minX).toInt
       y := (env.minY).toInt
-      g.drawImage2(image, x, y)
+      g.drawImage(image, x, y)
     }
     else
     {

chunmap/view/fan/render/GeneralSym.fan

 //   2011-05-03  Jed Young  Creation
 //
 
-using gfx
-using gfx2
+using fgfx2d
 
 using chunmapModel
 using chunmapData

chunmap/view/fan/render/GeometryNodeSym.fan

 //   2011-09-30  Jed Young  Creation
 //
 
-using gfx
-using gfx2
+using fgfx2d
 
 using chunmapModel
 using chunmapData

chunmap/view/fan/render/GeometrySym.fan

 //   2011-09-30  Jed Young  Creation
 //
 
-using gfx
-using gfx2
+using fgfx2d
 
 using chunmapModel
 using chunmapData

chunmap/view/fan/render/ImagePointSym.fan

 //   2011-09-30  Jed Young  Creation
 //
 
-using gfx
-using gfx2
+using fgfx2d
 
 using chunmapModel
 using chunmapData
 @Js
 const class ImagePointSym : GeometrySym
 {
-  const Image image
+  const ConstImage image
 
   new make(|This| f)
   {

chunmap/view/fan/render/LabelSym.fan

 //
 
 using concurrent
-using gfx
-using gfx2
-using fan3dMath
+using fgfx2d
+using fgfxMath
 
 using chunmapModel
 using chunmapData

chunmap/view/fan/render/MutexSym.fan

 //   2011-09-30  Jed Young  Creation
 //
 
-using gfx
-using gfx2
+using fgfx2d
 
 using chunmapModel
 using chunmapData

chunmap/view/fan/render/RasterSym.fan

 //   2011-09-30  Jed Young  Creation
 //
 
-using gfx
-using gfx2
+using fgfx2d
 
 using chunmapModel
 using chunmapData
 
       src := Rect(0, 0, image.size.w, image.size.h)
       dest := Rect(x, y, w, h)
-      g.copyImage2(image, src, dest)
+      g.copyImage(image, src, dest)
     }
     else
     {

chunmap/view/fan/render/RenderEnv.fan

 //   2011-05-03  Jed Young  Creation
 //
 
-using gfx2
+using fgfx2d
 
 using chunmapModel
 using chunmapData
 @Js
 class RenderEnv
 {
-  Graphics2? g
+  Graphics? g
   Feature? data
   ViewPort? view
 }

chunmap/view/fan/render/Renderer.fan

 //   2011-05-03  Jed Young  Creation
 //
 
-using gfx
+using fgfx2d
 using chunmapData
 
 **

chunmap/view/fan/render/SimpleLineSym.fan

 //   2011-09-30  Jed Young  Creation
 //
 
-using gfx
-using gfx2
+using fgfx2d
 
 using chunmapModel
 using chunmapData
     if (g.brush != brush) g.brush = brush
     if (g.pen != pen) g.pen = pen
 
-    g.drawPolyline2(DrawHelper.toIntArray(ls, r))
+    g.drawPolyline(DrawHelper.toIntArray(ls, r))
   }
 }

chunmap/view/fan/render/SimplePointSym.fan

 //   2011-09-30  Jed Young  Creation
 //
 
-using gfx
-using gfx2
+using fgfx2d
 
 using chunmapModel
 using chunmapData

chunmap/view/fan/render/SimplePolygonSym.fan

 //   2011-09-30  Jed Young  Creation
 //
 
-using gfx
-using gfx2
+using fgfx2d
 
 using chunmapModel
 using chunmapData
     if (fill)
     {
       if (g.brush != brush) g.brush = brush
-      g.fillPolygon2(ps)
+      g.fillPolygon(ps)
     }
 
     if (stroke)
     {
       if (g.brush != strokeBrush) g.brush = strokeBrush
       if (g.pen != pen) g.pen = pen
-      g.drawPolyline2(ps)
+      g.drawPolyline(ps)
     }
   }
 }

chunmap/view/fan/render/Symbolizer.fan

 //   2011-05-03  Jed Young  Creation
 //
 
-using gfx
+using fgfx2d
 using chunmapData
 
 **
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.