首页 / 浏览问题 / 三维GIS / 问题详情
桌面导出粒子如何加载到iclient
204EXP 2016年12月13日
Idesktop导出的粒子如何加载到iclient3D中

1个回答

您好,iDesktop导出的粒子文件是不能直接加载到iClent3D的呢。

有2个办法,

(1)您直接在桌面配好场景,iserver发布三维服务,客户端访问这个场景,粒子对象都是存在的。

(2)客户端是可以动态添加粒子对象的,请查阅iClent3D客户端手册中ParticleSystem类,详细介绍可以搜索关键字“三维特效”。
3,389EXP 2016年12月13日
兄弟,帮我看看这代码有问题不,我想弄个喷泉

var point3D = new SuperMap.Web.Core.GeoPoint3D(newSuperMap.Web.Core.Point3D(116.37474166666475,39.99939608317955,11));
    var rainParticle = new SuperMap.Web.Core.GeoParticle();
    rainParticle.makeWithGeometry(point3D);
    //初始化 rainParticle 持有的 rainPariticleSystem
    var rainparticleSystem = rainoParticle.getParticleSystemByIndex(0);
    if (rainparticleSystem == null)
    {
            return;
    }
    rainParticle.set_particleType(SuperMap.Web.Core.ParticleType.Fountain);
    rainparticleSystem.set_particleWidth(35);
    rainparticleSystem.set_particleHeight(30);
    rainparticleSystem.set_particleCountPerSecond(13000);
    var feature3D = new SuperMap.Web.Core.Feature3D();
    feature3D.set_geometry(point3D);
    feature3D.set_style3D(rainStyle3D);
    trackingLayer.add(feature3D, "Rain");
您这儿错了:
feature3D.set_geometry(point3D);
改为:
feature3D.set_geometry(rainparticleSystem);
参考:
构造 geoPoint3D 对象,火焰/烟雾/烟火/喷泉/爆炸/尾焰粒子关联的 Geometry 必须为 GeoPoint3D 类型的对象
         var geoPoint3D = new SuperMap.Web.Core.GeoPoint3D(new SuperMap.Web.Core.Point3D(116.38817, 39.99263, 30)); 
                
        构造粒子几何对象并关联 Gemotry 对象为 geoPoint3D
         var geoParticle = new SuperMap.Web.Core.GeoParticle();
        if (geoParticle.makeWithGeometry(geoPoint3D) == false)
        {
                return;
        }
                
        设置粒子效果类型,可参见 ParticleType 枚举
         geoParticle.set_particleType(SuperMap.Web.Core.ParticleType.Fire);

        获取 geoParticle 对象所持有的 rainPariticleSystem
         var particleSystem = geoParticle.getParticleSystemByIndex(0);
        if (particleSystem == null)
        {
                return;
        }

        设置粒子系统对象的各项参数
         particleSystem.set_particleWidth(500);
        particleSystem.set_particleHeight(700);
        particleSystem.set_particleCountPerSecond(13000);

        构造 Feature3D 对象,设置几何对象为 geoParticle
         var feature3D = new SuperMap.Web.Core.Feature3D();
        feature3D.set_geometry(geoParticle);

        获取跟踪图层并在跟踪图层添加 feature3D 对象
         trackingLayer.add(feature3D, "particle");
谢谢了哥们晚上我回家再弄一下,要是弄不出来明天还得麻烦您。
我改成这样还是不好使,这个我加在昨天你给我调的那块代码中,那个代码中还有粒子火,对于

var rainparticleSystem = rainoParticle.getParticleSystemByIndex(0);

会有影响吗?还有我想让小车到指定位置的时候停下一段时间,然后让我设置的喷泉灭火。

var point3D = new SuperMap.Web.Core.GeoPoint3D(new SuperMap.Web.Core.Point3D(116.37454984776,40.0004210056727,11));
    var rainParticle = new SuperMap.Web.Core.GeoParticle();
    if(rainParticle.makeWithGeometry(point3D)==false){
        return;
    }
    rainParticle.set_particleType(SuperMap.Web.Core.ParticleType.Fountain);
    
    //初始化 rainParticle 持有的 rainPariticleSystem
    var rainparticleSystem = rainoParticle.getParticleSystemByIndex(0);
    alert(rainparticleSystem);
    if (rainparticleSystem == null)
    {
            return;
    }
    rainparticleSystem.set_particleWidth(35);
    rainparticleSystem.set_particleHeight(30);
    rainparticleSystem.set_particleCountPerSecond(13000);
    var rainStyle3D = new SuperMap.Web.Core.Style3D();
   
    rainStyle3D.set_altitudeMode(SuperMap.Web.Realspace.AltitudeMode.ABSOLUTE);

  
    var feature3D = new SuperMap.Web.Core.Feature3D();
    feature3D.set_geometry(rainParticle);
    feature3D.set_style3D(rainStyle3D);
    trackingLayer.add(feature3D, "Rain");
我这么写可以看到喷泉但是如果加上火粒子的话,喷泉就会消失,只能看到火粒子

var geoPoint3D1 = new SuperMap.Web.Core.GeoPoint3D(new SuperMap.Web.Core.Point3D(116.37454984776,40.0004210056727,11));

     var fountainParticle = new SuperMap.Web.Core.GeoParticle();
     fountainParticle.set_particleFilePath("fountain.par");
     fountainParticle.makeWithGeometry(geoPoint3D1);
     fountainParticle.set_scaleX(2.5);
     fountainParticle.set_scaleY(5);
     fountainParticle.set_scaleZ(2.5);

     fountainParticle.set_rotationX(-90);

     var feature1 = new SuperMap.Web.Core.Feature3D();
     feature1.set_geometry(fountainParticle);
     feature1.set_style3D(particleStyle3D);

     trackingLayer.add(feature1, "fountainParticle");

试试通过rainParticle.set_particleType(SuperMap.Web.Core.ParticleType.Fountain)枚举来设置正常吗。

问题都解决了,现在火,喷泉,车都可以显示了。

现在的问题就是,小车到指定位置的时候停下一段时间,然后让我设置的喷泉灭火。

你真厉害~yesyes

如何控制粒子效果的时间长度?
您看一下这个:

ParticleSystem类成员,有个particleLifeTime属性,获取或设置粒子系统对象中每个粒子的生命周期,即粒子从产生到消亡的时间长度,单位:毫秒。
这个方法确实可以设置消失的时间。但是消失的时间与我设置的时间不符合啊

set_particleLifeTime(5000);火的我设置了5秒但是它却45秒才消失。
如果这个属性不好使的话,直接在5秒后,直接把这个对象移除了吧。
您好,我这有个新问题给领导看完我做的消防模拟之后他们感觉这个水跟活比起来比较小,所以感觉比较假。但是iClient无法控制喷泉的流量什么的?请问该怎么办。我知道Idesktop可以对粒子参数进行各种配置。有什么办法结合一下吗?

可以设置的呢

function displayRain()
{
        //初始化 rainRegion,降雨/降雪粒子关联的 Geometry 必须为 GeoRegion3D 类型
        var point3Ds = new SuperMap.Web.Core.Point3Ds();
        point3Ds.add(new SuperMap.Web.Core.Point3D(114.5628, 40.272031, 200));
        point3Ds.add(new SuperMap.Web.Core.Point3D(120.11412, 40.383005, 200));
        point3Ds.add(new SuperMap.Web.Core.Point3D(119.7380, 39.11966, 200));
        point3Ds.add(new SuperMap.Web.Core.Point3D(114.5358, 39.15709, 200));
        var rainRegion = new SuperMap.Web.Core.GeoRegion3D();
        rainRegion.addPart(point3Ds);
        //初始化 geoParticel,设置粒子效果类型并关联 Gemotry 对象为 rainRegion
        var rainParticle = new SuperMap.Web.Core.GeoParticle();
        rainParticle.set_particleType(SuperMap.Web.Core.ParticleType.Rain);
        if (rainParticle.makeWithGeometry(rainRegion) == false)
        {
                return;
        }
        
        //初始化 rainParticle 持有的 rainPariticleSystem 
        var rainparticleSystem = rainoParticle.getParticleSystemByIndex(0);
        if (rainparticleSystem == null)
        {
                return;
        }
        //设置粒子大小、每秒产生的粒子数量
        rainparticleSystem.set_particleWidth(500);
        rainparticleSystem.set_particleHeight(700);
        rainparticleSystem.set_particleCountPerSecond(13000);
        //获取 rainStyle3D,设置绝对高度模式属性并定义相应的高度值,用以实现雨从天空缓缓的落下
        var rainStyle3D = new SuperMap.Web.Core.Style3D();
        rainStyle3D.set_extendHeight(30000);
        rainStyle3D.set_altitudeMode(SuperMap.Web.Realspace.AltitudeMode.ABSOLUTE);
        //获取 feature3D,关联 geometry 对象为 rainParticle 并设置 style3D 对象为 rainStyle3D 
        var feature3D = new SuperMap.Web.Core.Feature3D();
        feature3D.set_geometry(rainParticle);
        feature3D.set_style3D(rainStyle3D);
        //获取 trackingLayer 图层添加要素对象
        trackingLayer.add(feature3D, "Rain");
}
好像不是这么回事,不知道您试没试过给喷泉这么设置,我刚才试了根本不是想象中的效果
...