com.supermap.ar.areffect.excavator

Class PitObject

  • java.lang.Object
    • com.supermap.ar.areffect.excavator.PitObject


  • public class PitObject
    extends java.lang.Object
    Pothole object

    For rendering excavation results

         SampleCode:
    //Occlusion settings occlusionHelper = arView.getOcclusionHelper(); occlusionHelper.init(0.36f) .setRenderMode(OcclusionHelper.RenderMode.NORMAL); //Using ARGeoPrism to build a "detection wall" List roomBounds = Arrays.asList( new Point3D(-1, -1, -2), new Point3D(-1, 6, -2), new Point3D(6, 6, -2), new Point3D(6, -1, -2), new Point3D(-1, -1, -2) ); ARGeoPrism geoVerticalRegion = new ARGeoPrism(); geoVerticalRegion.setParentNode(arView); geoVerticalRegion.setRenderable(false);//Not rendered, only used for ray detection geoVerticalRegion.addPart(roomBounds,6.0f); //Creates an excavation tool, before that, you need to confirm that AREffectView has enabled the occlusion setting //ExcavatorAll subclasses use the same method excavatorWall = new WallExcavator(geoVerticalRegion); //pothole texture Bitmap bitmap=null; Bitmap bitmap2=null; try { InputStream is = getApplicationContext().getAssets() .open("brown_mud_dry2.png"); bitmap= BitmapFactory.decodeStream(is); InputStream is2 = getApplicationContext().getAssets() .open("wall_texture.png"); bitmap2= BitmapFactory.decodeStream(is2); is.close(); is2.close(); } catch (IOException e) { } //Creates a Pothole Render Object pitWall = new PitObject(excavatorWall) .setTexture(bitmap,bitmap2); //Called every frame refresh (usually used EffectView#addOnUpdateListener(EffectView. OnUpdateListener) Add frame monitoring event) arView.addOnUpdateListener(()->{ if (occlusionHelper.isEnabled()){ //desc-Performs screen cropping ArrayList screenPoint = null; if (excavatorWall !=null){ //Calculates screen coordinates screenPoint = excavatorWall.getScreenPoint(null); if (screenPoint!=null){ //Refreshes the clipping range according to the screen coordinates occlusionHelper.setUniquePointList(screenPoint).refresh(); dynamicView.updateLine(screenPoint); } } } }) // Excavation calculation wall collision point arView is AREffectView, screenPointX/Y is the corresponding screen coordinates //To calculate the collision point with the center of the screen in real time, put the following code into EffectView.OnUpdateListener Point3D hitPoint = excavatorWall .generateHitPoint(arView, screenPointX, screenPointY; if (hitPoint!=null){ //desc-Performs vertex calculations for excavation (excavation parameters) excavatorWall.calculate(ExcavationParameter.builder() .setRadius(radius) .setOffset(offset) .setInnerMargin(0) .setCenterPoint(hitPoint) .build()); } //Renders pothole results pitWall.updateMesh();
    • Constructor Summary

      Constructors 
      Constructor and Description
      PitObject(Excavator excavator)
      constructor
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      void destroy()
      destroys the rendered object
      android.graphics.Bitmap[] getTexture()
      gets texture
      void setEnabled(boolean enabled)
      sets enable state
      PitObject setTexture(android.graphics.Bitmap textureBm)
      Sets the texture
      PitObject setTexture(android.graphics.Bitmap bottomTexture, android.graphics.Bitmap sideTexture)
      Sets the texture
      PitObject setTexture(android.graphics.Bitmap bottomTexture, android.graphics.Bitmap sideTexture, android.graphics.Bitmap outLineTexture)
      Sets the texture
      boolean updateMesh()
      updates grid Called after excavation calculation
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PitObject

        public PitObject(Excavator excavator)
        constructor
    • Method Detail

      • getTexture

        public android.graphics.Bitmap[] getTexture()
        gets texture
        Returns:
        texture, returns an array. The first value is the side texture, the second value is the bottom texture
      • setTexture

        public PitObject setTexture(android.graphics.Bitmap bottomTexture,
                                    android.graphics.Bitmap sideTexture,
                                    android.graphics.Bitmap outLineTexture)
        Sets the texture
        Parameters:
        bottomTexture - bottom texture
        sideTexture - side texture
        outLineTexture - edge outline texture
        Returns:
        pothole object
      • setTexture

        public PitObject setTexture(android.graphics.Bitmap bottomTexture,
                                    android.graphics.Bitmap sideTexture)
        Sets the texture
        Parameters:
        bottomTexture - bottom texture
        sideTexture - side texture
        Returns:
        pothole object
      • setTexture

        public PitObject setTexture(android.graphics.Bitmap textureBm)
        Sets the texture
        Parameters:
        textureBm -
        Returns:
      • destroy

        public void destroy()
        destroys the rendered object
      • updateMesh

        public boolean updateMesh()
        updates grid

        Called after excavation calculation

        Returns:
        no collision wall, returns false
      • setEnabled

        public void setEnabled(boolean enabled)
        sets enable state
        Parameters:
        enabled - state