所以,目前我已经成功编译了程序(使用RInside),用于在 Google 的静态地图(在Qt上)上绘制坐标。
现在,我必须在地图上绘制从 GPS 接收到的坐标。
是否有可能以某种方式“即时”在 png 上显示新绘制的点?
我的意思是我不希望每次收到新点时都从硬盘中读取 png。
从这里:http ://cran.r-project.org/web/packages/png/png.pdf
这个包提供了一种简单的方法来读取、写入和显示以 PNG 格式存储的位图图像。它可以读写文件和内存中的原始向量。
这有什么帮助吗?
#include <RInside.h>
#include <Rcpp.h>
#include <iostream>
int main (int argc, char *argv[])
{
std :: cout << "\nThank-SO :-)\n";
RInside R (argc, argv);
std :: string txtA = "library(RgoogleMaps)";
std :: string txtB = "png(filename='Rg.png', width=480, height=480)";
std :: string txtC = "lat = c(40.702147,40.718217,40.711614)";
std :: string txtD = "lon = c(-74.012318,-74.015794,-73.998284)";
std :: string txtE = "center = c(mean(lat), mean(lon))";
std :: string txtF = "zoom <- min(MaxZoom(range(lat), range(lon)))";
std :: string txtG = "MyMap <- GetMap(center=center, zoom=zoom, markers='&40.702147,-74.015794,blues%7C40.711614,-74.012318,greeng%7C40.718217,-73.998284,redc', destfile='My.png')";
std :: string txtH = "tmp <- PlotOnStaticMap(MyMap,lat=c(40.702147,40.711614,40.718217),lon=c(-74.015794,-74.012318,-73.998284),cex=1.5,pch=20,col=c('red', 'blue', 'green'),add=F)";
std :: string txtI = "dev.off()";
R.parseEvalQ (txtA);
R.parseEvalQ (txtB);
R.parseEvalQ (txtC);
R.parseEvalQ (txtD);
R.parseEvalQ (txtE);
R.parseEvalQ (txtF);
R.parseEvalQ (txtG);
R.parseEvalQ (txtH);
R.parseEvalQ (txtI);
return 0;
}
这是C++
用RInside
.