com.supermap.data
类 Model
- java.lang.Object
-
- com.supermap.data.InternalHandle
-
- com.supermap.data.InternalHandleDisposable
-
- com.supermap.data.Model
-
- 所有已实现的接口:
- IDisposable
public class Model extends com.supermap.data.InternalHandleDisposable
模型数据集。该类为用于存储三维几何模型对象(GeoModel3D)的数据集。- 作者:
- Administrator
-
-
方法概要
所有方法 静态方法 实例方法 具体方法 限定符和类型 方法和说明 void
add(Skeleton skeleton)
以非实例化方式向精细层添加骨架对象。void
add(Skeleton skeleton, double[] matrix)
以非实例化方式向精细层添加骨架对象,并指定外部矩阵。boolean
addSkeleton(ModelEntityManager em, String name)
向精细层添加骨架。boolean
addSkeleton(ModelEntityManager em, String name, double[] matrix)
向精细层添加骨架。boolean
buildLOD()
创建LOD。static int
byte4ToInt(byte[] bytes)
static void
byteToFile(String filePath, byte[] data)
ArrayList<Model>
decompose()
将模型对象打散。void
dispose()
释放Model对象占用的资源。static byte[]
fileToByteArray(File file)
boolean
fromFile(String filePath)
boolean
fromStreamFile(byte[] byteFile)
String
getAvailableName(String name)
获取模型对象中未被占用的名字 。BoundingBox
getBoundingBox()
获取指定骨架的包围盒,同时考虑矩阵。BoundingBox
getBoundingBox(SkeletonID id)
获取指定骨架的包围盒,同时考虑矩阵。double
getBoundingSphere(SkeletonID id, Point3D centerPoint)
获取指定骨架的包围球,同时考虑矩阵。int[]
getInfo(int lod)
获取模型数据集信息。int
getLODCount()
获取LOD层级数量。Material3D
getMaterial(String name)
按名称获取材质对象。String
getMaterialName(SkeletonID id)
返回材质名称。ArrayList<String>
getMaterialNames()
返回对象所包含的材质名称集合。Skeleton
getSkeleton(SkeletonID id)
获取指定的骨架。Skeleton
getSkeleton(SkeletonID id, double[] matrix)
获取模型中指定的骨架及所在数据包的矩阵。Skeleton
getSkeleton(String name)
按名称获取骨架对象。int
getSkeletonCount(int nLodIndex)
获取骨架数量。int[]
getSkeletonInfo(SkeletonID id)
返回骨架信息。ArrayList<String>
getSkeletonNames(int nLod)
返回模型指定层级的所有骨架名称。TextureData
getTexture(String name)
返回纹理。int
getTriangleCount(SkeletonID skeletonId)
获取指定子骨架的三角形数量。int
getVertexCount(SkeletonID skeletonId)
获取指定子骨架的顶点数量。static byte[]
intToByte4(int i)
boolean
isClosed()
判断模型数据集是否闭合。boolean
isEmpty()
获取包围盒对象是否为空。boolean
isHasLOD()
static String
numberToSuffix(int number)
boolean
removeLOD()
移除LOD层级。boolean
removeSkeleton(SkeletonID id)
移除指定编号的骨架对象。boolean
removeSkeleton(String name)
boolean
setLODs(ArrayList<Model> listModel)
设置传入的模型数据作为LOD层 。boolean
setLODs(ArrayList<Model> listModel, ArrayList<Double> listLodScales)
boolean
setMaterial(ArrayList<SkeletonID> ids, Material3D material3D)
对指定骨架设置材质。void
setMatrix(double[] matrix)
设置外部矩阵。void
setMatrix(Matrix matrix)
boolean
toFile(String filePath)
byte[]
toStreamFile()
void
unloadEntities()
卸载模型中的实体boolean
update(Material3D material3D)
根据材质更新模型中的同名材质对象。void
update(Skeleton skeleton)
更新模型中的同名材质对象。
-
-
-
构造器详细资料
-
Model
public Model()
构造一个新的Model对象。
-
Model
public Model(Model model)
根据给定的Model对象构造一个与之完全一样的新Model对象。- 参数:
model
- 给定的Model对象。
-
-
方法详细资料
-
dispose
public void dispose()
释放Model对象占用的资源。
-
getLODCount
public int getLODCount()
获取LOD层级数量。- 返回:
- LOD层级数量。
-
isClosed
public boolean isClosed()
判断模型数据集是否闭合。当精细层所有骨架闭合时返回true。- 返回:
-
isEmpty
public boolean isEmpty()
获取包围盒对象是否为空。- 返回:
-
isHasLOD
public boolean isHasLOD()
- 返回:
-
getSkeletonCount
public int getSkeletonCount(int nLodIndex)
获取骨架数量。- 参数:
nLodIndex
- 指定的LOD层级。- 返回:
- 骨架数量。
-
getVertexCount
public int getVertexCount(SkeletonID skeletonId)
获取指定子骨架的顶点数量。- 参数:
skeletonId
- 子骨架ID。- 返回:
- 顶点数量。
-
getTriangleCount
public int getTriangleCount(SkeletonID skeletonId)
获取指定子骨架的三角形数量。- 参数:
skeletonId
- 子骨架ID。- 返回:
- 三角形数量。
-
fromFile
public boolean fromFile(String filePath)
-
toFile
public boolean toFile(String filePath)
-
getBoundingBox
public BoundingBox getBoundingBox()
获取指定骨架的包围盒,同时考虑矩阵。- 返回:
-
fromStreamFile
public boolean fromStreamFile(byte[] byteFile)
-
toStreamFile
public byte[] toStreamFile()
-
intToByte4
public static byte[] intToByte4(int i)
-
byte4ToInt
public static int byte4ToInt(byte[] bytes)
-
numberToSuffix
public static String numberToSuffix(int number)
-
fileToByteArray
public static byte[] fileToByteArray(File file)
-
byteToFile
public static void byteToFile(String filePath, byte[] data)
-
getSkeleton
public Skeleton getSkeleton(SkeletonID id)
获取指定的骨架。- 参数:
id
- 骨架编号。- 返回:
-
getSkeleton
public Skeleton getSkeleton(SkeletonID id, double[] matrix)
获取模型中指定的骨架及所在数据包的矩阵。- 参数:
id
- 骨架编号。matrix
- 数据包的矩阵。- 返回:
-
getSkeletonNames
public ArrayList<String> getSkeletonNames(int nLod)
返回模型指定层级的所有骨架名称。- 参数:
nLod
- 模型层级,lod为-3时获取所有lod层的骨架名称,为-2时获取所有骨架名称,为-1时获取精细层所有骨架名称,大于等于0时获取对应lod层的骨架名称。- 返回:
- 骨架名称。
- 抛出:
IllegalStateException
- 当前对象已被释放。- 从以下版本开始:
- 11.2.0。
-
getMaterial
public Material3D getMaterial(String name)
按名称获取材质对象。- 参数:
name
- 指定的材质名称。- 返回:
-
getMaterialNames
public ArrayList<String> getMaterialNames()
返回对象所包含的材质名称集合。- 返回:
- 材质名称集合。
- 抛出:
IllegalStateException
- 当前对象已被释放。- 从以下版本开始:
- 11.2.0。
-
getMaterialName
public String getMaterialName(SkeletonID id)
返回材质名称。根据对象的骨架ID来获取材质名称。- 参数:
id
- 骨架ID。- 抛出:
IllegalStateException
- 当前对象已被释放。- 从以下版本开始:
- 11.2.0。
-
getTexture
public TextureData getTexture(String name)
返回纹理。根据对象的纹理名称来获取纹理数据。- 参数:
name
- 对象的纹理名称。
-
getSkeletonInfo
public int[] getSkeletonInfo(SkeletonID id)
返回骨架信息。根据对象的骨架编号来获取骨架信息。- 参数:
id
- 对象的骨架编号- 返回:
- 结果数组,第一个为顶点数量,第二个为三角形数量。
-
getInfo
public int[] getInfo(int lod)
获取模型数据集信息。- 参数:
lod
- 指定的LOD层级。- 返回:
- 指定结果数组,第一个为顶点数量,第二个为三角形数量。
-
add
public void add(Skeleton skeleton)
以非实例化方式向精细层添加骨架对象。- 参数:
skeleton
- 待添加的骨架对象。
-
add
public void add(Skeleton skeleton, double[] matrix)
以非实例化方式向精细层添加骨架对象,并指定外部矩阵。- 参数:
skeleton
- 待添加的骨架对象。matrix
- 指定的外部矩阵。
-
buildLOD
public boolean buildLOD()
创建LOD。- 返回:
- 是否创建成功,true成功,false失败。
-
getAvailableName
public String getAvailableName(String name)
获取模型对象中未被占用的名字 。- 参数:
name
- 骨架对象名字。- 返回:
- 未被占用的名字。
-
getBoundingBox
public BoundingBox getBoundingBox(SkeletonID id)
获取指定骨架的包围盒,同时考虑矩阵。- 参数:
id
- 骨架编号。- 返回:
- 指定骨架的包围盒。
-
getBoundingSphere
public double getBoundingSphere(SkeletonID id, Point3D centerPoint)
获取指定骨架的包围球,同时考虑矩阵。- 参数:
id
- 骨架编号。centerPoint
- 包围球中心点。- 返回:
- 球半径,-1失败,大于等于0成功。
-
removeLOD
public boolean removeLOD()
移除LOD层级。- 返回:
- 是否移除成功,true成功,false失败。
-
removeSkeleton
public boolean removeSkeleton(SkeletonID id)
移除指定编号的骨架对象。- 参数:
id
- 待移除的骨架编号。- 返回:
- 是否移除成功,true成功,false失败。
-
removeSkeleton
public boolean removeSkeleton(String name)
-
setMatrix
public void setMatrix(double[] matrix)
设置外部矩阵。- 参数:
matrix
- 指定的矩阵。
-
update
public void update(Skeleton skeleton)
更新模型中的同名材质对象。- 参数:
skeleton
- 同名材质的对象。
-
update
public boolean update(Material3D material3D)
根据材质更新模型中的同名材质对象。- 参数:
material3D
- 指定同名的材质对象- 返回:
- 返回true,表示更新成功;返回false,表示更新失敗。
- 抛出:
IllegalStateException
- 当前对象已被释放。- 从以下版本开始:
- 11.2.0。
-
setMaterial
public boolean setMaterial(ArrayList<SkeletonID> ids, Material3D material3D)
对指定骨架设置材质。- 参数:
ids
- 指定的骨架ID集合。material3D
- 替换的材质对象。- 返回:
- 是否替换成功。返回true表示替换成功,返回false表示替换失败。
- 抛出:
IllegalStateException
- 当前对象已被释放。- 从以下版本开始:
- 11.2.0。
-
addSkeleton
public boolean addSkeleton(ModelEntityManager em, String name)
向精细层添加骨架。- 参数:
em
- 指定模型管理实体对象。name
- 骨架名称。- 返回:
- 是否添加成功。true表示成功,false表示失败。
-
addSkeleton
public boolean addSkeleton(ModelEntityManager em, String name, double[] matrix)
向精细层添加骨架。- 参数:
em
- 指定模型管理实体对象。name
- 骨架名称。matrix
- 指定的外部矩阵。- 返回:
- 是否添加成功。true表示成功,false表示失败。
-
setMatrix
public void setMatrix(Matrix matrix)
-
unloadEntities
public void unloadEntities()
卸载模型中的实体
-
-
Copyright © 2021–2024 SuperMap. All rights reserved.