我有坐标标记在我的数据库中,我正试图在我的地图上绘制标记,但我不能这样做,这是我的ShowMarker::
@Component
@Scope
@ManagedBean
public class ShowMarker {
// =========================================================================
// ATTRIBUTES
// =========================================================================
private Point point ;
private PointService pointService;
private MapModel emptyModel;
public ShowMarker() {
super();
// TODO Auto-generated constructor stub
}
// =========================================================================
// METHODS
// =========================================================================
@SuppressWarnings("unchecked")
public List<Point>getAllPoint(){
List<Point>points=pointService.getAllPoint();
for(Point point : points){
System.out.println("=======>"+point.getTitre());
System.out.println("==========>"+point.getLatitude());
System.out.println("==========>"+point.getLongitude());
Marker marker = new Marker(new LatLng(point.getLatitude(), point.getLongitude()));
emptyModel.addOverlay(marker);
}
return points ;
}
@PostConstruct
public void reint(){
point = new Point();
}
@PostConstruct
public void init() {
emptyModel = new DefaultMapModel();
}
// =========================================================================
// GETTERS & SETTERS
// =========================================================================
public Point getPoint() {
return point;
}
public void setPoint(Point point) {
this.point = point;
}
public MapModel getEmptyModel() {
return emptyModel;
}
public void setEmptyModel(MapModel emptyModel) {
this.emptyModel = emptyModel;
}
@Autowired
public void setPointService(PointService pointService) {
this.pointService = pointService;
}
}
这是XHTML页面::
<h:head>
<title>show marker</title>
</h:head>
<h:body>
<ui:composition template="../../template/template_.xhtml">
<ui:define name="content">
<h:form id="form">
<p:growl id="msgs" />
<p:dataTable id="usersTable" value="#{showMarker.allPoint}" var="point">
<p:column>
<f:facet name="header">
<h:outputText value="titre" />
</f:facet>
<h:outputText value="#{point.titre}" />
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="long" />
</f:facet>
<h:outputText value="#{point.longitude}" />
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="latitude" />
</f:facet>
<h:outputText value="#{point.latitude}" />
</p:column>
</p:dataTable>
</h:form>
<h:form>
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>
<p:gmap id="gmap" center="36.8463044,10.1992342" zoom="16" type="HYBRID" style="width:1200px;height:700px" widgetVar="map"
model="#{showMarker.emptyModel}"
/>
</h:form>
</ui:define>
</ui:composition>
</h:body>
</html>
我有数据表中的标记和坐标列表,但是我没有地图中的标记,你能帮我吗
public ShowMarker() {
emptyModel = new DefaultMapModel();
}