小编Don*_*rco的帖子

OL3:按坐标从图层中获取特征

我想通过坐标获取图层的特征。此外,我想在弹出窗口中打开此功能,到目前为止我已经通过一个 onclick 事件解决了这个问题。但是我想通过给出特征的坐标并打开特征的弹出窗口来实现。

我有一个带有地图的图层和一个带有以下功能的图层:

if (trackMap != null) {
  for (var i = 0; i < trackMap.length; i++) {
    var trackInfo = trackMap[i];
    lat = parseFloat(trackInfo.lat);
    lon = parseFloat(trackInfo.lon);

    var layergpx = new ol.layer.Vector({
      source: new ol.source.Vector({
        parser: new ol.parser.GPX(),
        url: '${contextRoot}/gps/gpx2' + trackInfo.url
      })
    });
    layers.push(layergpx);
  }
}
Run Code Online (Sandbox Code Playgroud)

我想在另一个 Javascript 函数中获取该层的功能。

我如何通过单击地图打开弹出窗口:

/**
 * The Click Event to show the data
 */
var element = document.getElementById('popup');
var popup = new ol.Overlay({
      element: element,
      positioning: ol.OverlayPositioning.BOTTOM_CENTER,
      stopEvent: false
});
map.addOverlay(popup); …
Run Code Online (Sandbox Code Playgroud)

javascript openlayers-3

5
推荐指数
1
解决办法
1万
查看次数

OL3:缩放到地图上的矢量图层

我有一个带有openlayers 3和矢量图层的地图.我想要映射以调整大小到这个矢量图层,但到目前为止,我能够得到的是将地图置于此向量的最后一个点上,因为在创建地图时无法访问矢量图层的点:

if (trackMap != null) {
  for (var i = 0; i < trackMap.length; i++) {
    var trackInfo = trackMap[i];
    lat = parseFloat(trackInfo.lat);
    lon = parseFloat(trackInfo.lon);

    var layergpx = new ol.layer.Vector({
      source: new ol.source.Vector({
        parser: new ol.parser.GPX(),
        url: '${contextRoot}/gps/gpx2' + trackInfo.url
      })
    });
    layers.push(layergpx);
    vectorLayers.push(layergpx);
  }
}

map = new ol.Map({
  controls: ol.control.defaults().extend([
    new ol.control.FullScreen()
  ]),
  layers: layers,
  renderer: ol.RendererHint.CANVAS,
  target: 'map',
  view: new ol.View2D({
    center: ol.proj.transform([lon, lat], 'EPSG:4326', 'EPSG:3857'),
    zoom: 13
  })
});
Run Code Online (Sandbox Code Playgroud)

javascript openlayers-3

5
推荐指数
3
解决办法
9979
查看次数

在Tomcat7上部署JSP Web应用程序(通过带GIT的OpenShift)

我已经构建了一个Web应用程序,其中包含一个带有mysql数据库和tomcat7服务器的Spring MVC项目.现在发布到OpenShift的GIT.但启动服务器只需160毫秒,我可以清楚地看到没有任何正在加载.

如何进行实际部署并将Openshift Tomcat连接到我的项目?我可以编码,但部署方面我不是一个聪明的灯泡.

我的GIT存储库看起来像这样: GitPicture1

怎么了?

编辑: 根据要求pom.xml:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.afterguard</groupId>
  <artifactId>SailPlanner</artifactId>
  <version>0.8.0</version>
  <packaging>war</packaging>
  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
  </properties>
  <profiles>
    <profile>
        <id>openshift</id>
        <build>
            <finalName>sailplanner</finalName>
            <plugins>
                <plugin>
                    <artifactId>maven-war-plugin</artifactId>
                    <version>2.6</version>
                    <configuration>
                        <outputDirectory>webapps</outputDirectory>
                        <warName>ROOT</warName>
                    </configuration>
                </plugin>
            </plugins>
        </build>
    </profile>
  </profiles>
  <build>
    <sourceDirectory>src</sourceDirectory>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.3</version>
        <configuration>
          <source>1.7</source>
          <target>1.7</target>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-war-plugin</artifactId>
        <version>2.6</version>
        <configuration>
          <warSourceDirectory>WebContent</warSourceDirectory>
          <failOnMissingWebXml>false</failOnMissingWebXml>
        </configuration>
      </plugin>
    </plugins>
  </build>
  <dependencies>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context</artifactId>
        <version>4.1.6.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-aop</artifactId>
        <version>4.1.6.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-webmvc</artifactId>
        <version>4.1.6.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-web</artifactId> …
Run Code Online (Sandbox Code Playgroud)

java war tomcat7 openshift

5
推荐指数
1
解决办法
1033
查看次数

获取位置,如果已设置

我有一个函数来检查是否设置了一个int中的位.但我认为会有更快的实现,因为这个是线性的并且不能是最有效的,虽然我知道int应该在1到1024之间.

 public static int getBitPos(final int n) {
        if (Integer.bitCount(n) != 1)
            return Constants.UNDEFINED;
        else {
            for (int i = 0; i < Integer.MAX_VALUE; ++i) {
                if (testBit(n, i))
                    return i;
            }
        }
        return Constants.UNDEFINED;
    }
Run Code Online (Sandbox Code Playgroud)

testBit以下标准功能在哪里:

public static boolean testBit(final int n, final int pos) {
    int mask = 1 << pos;
    return (n & mask) == mask;
}
Run Code Online (Sandbox Code Playgroud)

但是桅杆是一种更快的方式,不存在吗?如果我有值17并且我想知道第4位(n = 8)是否已设置?应该有一种更快的方法来检查是否设置了n = 8的位...

希望你能帮我...

编辑1: 感谢您的支持.评论和回答让我误解了.我错误地设置了值,这使得它比需要的更复杂.我从不擅长换位.如果我想要设置第二位,我设置这样的值:

value = 2;
Run Code Online (Sandbox Code Playgroud)

如果我也想设置第4位,我根据第4位添加了值:

value += 8;
Run Code Online (Sandbox Code Playgroud)

因此值为10,并设置了第2和第4位.所以我把数字保存在我的班级中,而不是位位置(8为值,而不是第4位为4,......).改变这一点后,我可以摆脱我不必要的功能,这是超过顶部!谢谢大家的帮助!

java bit

0
推荐指数
1
解决办法
1176
查看次数

标签 统计

java ×2

javascript ×2

openlayers-3 ×2

bit ×1

openshift ×1

tomcat7 ×1

war ×1