- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我正在尝试查看 map 上存储在 postgreSQL 数据库中的一些对象。使用的框架是 spring 和 hibernate,前端是 angular.js。我已经检查了从 hibernate 返回的对象的 Controller 类、服务类。在类(class)水平上,他们都很好。但是当我检查 js (angular.js) 时,它有对象和数字。由于代码需要对象而不是数字,因此会发生错误。返回对象与此类似。
Array[5]
0:Object
1:20
2:Object
3:24
4:13
length:5
数组包含从 Controller 类返回的结果。在 map 上查看第一个对象。由于第二个是数字而不是对象,因此会生成错误。这是将对象返回到 angular.js 脚本的代码块。
@RequestMapping(value = "/crimerecode/getall.htm", method = RequestMethod.GET)
@ResponseBody
public List<CrimeRecord> getAllCrimeRecords(@RequestParam String startDate,@RequestParam String endDate) {
try {
// crds.invalidateCrimeRecord(cr.getGcrno());
System.out.println("=========controller===============");
for(int i=0;i<(crds.getAll(startDate, endDate)).size();i++){
System.out.println(((crds.getAll(startDate, endDate)).get(i).getTheGeom()));
}
return crds.getAll(startDate, endDate);
}
catch (ParseException ex) {
java.util.logging.Logger.getLogger(CrimeRecordController.class.getName()).log(Level.SEVERE, null, ex);
}
return null;
}
这是 Angular 脚本中的代码块...
$http.get('/CMISystem/crimerecode/getall.htm?startDate=' + $scope.startDate + '&endDate=' +
$scope.endDate
).
success(function(data) {
console.log(data);
alert(data);
data.forEach(function(value) {
console.log(value);
var geo = value.theGeom.geo;
var point = new OpenLayers.Geometry.Point(geo.lon, geo.lat);
point.transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject());
var pointFeature = new OpenLayers.Feature.Vector(point, value);
.....
}
我只在这里发布了类和javascript中的相关代码...
最佳答案
我认为问题出在 List<CrimeRecord>
你从你的getAllCrimeRecords
返回方法。
尝试创建一个数组列表并添加每个 CrimeRecord
对象,添加到您的数组列表,如以下示例所示。
public List<CrimeRecord> getAllCrimeRecords(@RequestParam String startDate, @RequestParam String endDate) {
List<CrimeRecord> cr = new ArrayList<CrimeRecord>();
try {
for (int i = 0; i < (crds.getAll(startDate, endDate)).size(); i++) {
cr.add(crds.getAll(startDate, endDate).get(i));
}
} catch (ParseException ex) {
java.util.logging.Logger.getLogger(CrimeRecordController.class.getName()).log(Level.SEVERE, null, ex);
}
return cr;
}
关于java - 从 hibernate 检索几何对象到 angular.js,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23191186/
我想知道是否可以将简单的位图转换为几何对象 最佳答案 是的,您可以使用跟踪。 Potrace是一个开源的位图到矢量跟踪器库。 然而,位图追踪并不完美。对于高质量的矢量图像,line tracer 一般
这类似于this question,但是却相反。 我有两个地理位置(纬度,经度)A和B。假设它们相距40海里。我想计算在A和B之间的直线上,从A点起10海里处的坐标。数学(我每天使用的其他一些数学),
我想计算一个点到由 2 个点定义的直线的距离。 我正在使用 javascript,这就是我使用维基百科得出的结论:https://en.wikipedia.org/wiki/Distance_from
我对 boost::geomentry 有疑问。 #include #include #include #include int main(){ typedef boost::geometry
我有一个问题。我想将四边形与四边形相交。 int main(){ typedef boost::geometry::model::point_xy TBoostPoint; typedef b
我无法在 OpleGL 中获得正确的转换。 我有 point3D - P(X,Y,Z) 和投影矩阵 M,它等于 K*(R|T) 其中 K - 相机标定矩阵 (R|T)——点(物)坐标系变换(R——旋转
我想做一个凸面(由一些直线或圆弧组成)围绕它的几何中心(Cx,Cy)旋转。同时凸面两侧有两个圆(由半径给出:R 和左中心:(Lx,Cy),右中心:(Rx,Cy))。表示与几何(Cy) X 轴相同的圆心
我有一个 DrawingVisual表示路径的元素,该路径的几何描述由此 syntax : "m106,59.3c0-1.98,0,0-4.95,0.989-3.96,0.989-13.8,3.96-
如何将我自己的数据集转换为可供 pytorch 几何图形神经网络使用的数据集? 所有教程都使用已转换为 pytorch 可用的现有数据集。例如,如果我有自己的点云数据集,我如何使用它来训练图神经网络的
我正在使用 PyQt5 和 OpenCV。我想创建一个读取视频帧并执行橡皮筋拉伸(stretch)以生成几何图形的类,该几何图形将由不同的类用于裁剪视频流(此示例中不包括第二类)。 在此示例中,从网络
我们有两个 (PostgreSQL 9.2) 表。第一城市: loc_id | integer | not null name | character
我有一张 table : create table if not exists places( id bigserial not null constraint places_pkey primary
我在 postgresql 中有一个带有 PostGIS geometry(point, 4326) 列(位置,使用 SRID 4326)的表,我有一个使用 SQL Alchemy 更新表(其余列)的
我开始使用 c++11 并尝试使用 boost geometry 运行一些示例代码 #include #include #include #include BOOST_GEOMETRY_REG
我有一个存储为 csv 文件的数据框,其中一列是多边形对象。但是,此列存储为字符串而不是 GeoPandas 几何对象。如何将此列转换为 Geopandas 几何对象以便执行地理分析? 这是我的数据的
我从两台相同品牌的相机拍摄的两张图像相距一定距离,拍摄相同的场景。我想计算两个相机之间的真实世界旋转和平移。为了实现这一点,我首先提取了两个图像的 SIFT 特征并匹配它们。 我现在有了基本矩阵以及单
我目前正在使用 boost 几何/空间索引库,以便对 3d 边界框执行范围查询。例如,我能够获得与查询边界框重叠的所有边界框的列表。 文档 ( http://www.boost.org/doc/lib
boost::geometry::model::point 将点的维度作为编译时参数。例如, typedef bg::model::point point; 有没有什么方法可以在运行时指定维度,比如说
我一直在寻找一种在 three.js 中将 uv 映射添加到我的自定义几何体的方法。我找到了这样做的方法,但我找到的解决方案都没有用。谁能解释一下 uv-mapping 的工作原理以及如何正确使用它?
在我的应用程序中,用户可以使用 iPhone 的 GPS 定义足球场的三个角落,方法是一个接一个地走到角落,然后点击按钮。这很好用,我可以在屏幕上绘制生成的矩形,类似于它在 Google map 中的
我是一名优秀的程序员,十分优秀!