如何在Google Map上绘制圆形和直线像素?(How to draw a circle and line on Google Map pixel-based?)
是否可以根据像素尺寸在Google地图上绘制圆和折线? 请允许我解释一下......
我在地图上有一个标记。 接下来,我想在它周围画一个圆圈,标记是确切的中心。 我希望圆圈具有固定的基于像素的半径。 但是,由于Google Maps API需要以米为单位的距离来确定半径,因此圆的大小会根据缩放级别而变化,这是我不想要的。
另一个例子是成角度的折线。 我从标记画出一条线到某个方向。 同样,距离基于米而不是像素,因此缩放缩小或增大线的大小。 另一个不需要的副作用是由于地图的精确投影(如果我理解正确的话),一条90度角的线不会在东方精确绘制。
我正在寻找的是这些绘图对象在地图上的便利性,而不是将它们与地图尺寸联系起来,只是硬像素。 这样的事情是否可能,或者它是否意味着我需要从头开始使用自定义div和某种SVG库?
Is it possible to draw circles and polylines on Google maps based on pixel dimensions? Allow me to explain...
I have a marker on a map. Next, I want to draw a circle around it, with the marker being the exact center. I'd like the circle to have a fixed pixel-based radius. However, as the Google Maps API takes distance in meters to base the radius on, the size of the circle varies based on the zoom level, which is what I do not want.
Another example is an angled Polyline. I'm drawing such a line from the marker into a certain direction. Again the distance is based on meters, not pixels, thus the zoom shrinks or grows the size of the line. Another unwanted side effect is that due the sperical projection of the map (if I understand this correctly), a line angled at 90 degrees, will not draw it precisely at east.
What I'm looking for is the convenience of these drawing objects on the map, without tying them to map dimensions, just to hard pixels. Is such a thing possible, or does it mean I need to start from scratch with a custom div and some kind of SVG library?
原文:https://stackoverflow.com/questions/22080256
最满意答案
你想要编译选项
-pthread
(如果你真的使用pthreads)。 如果你只是需要这些函数,它们在librt
所以使用-lrt
You want the compile option
-pthread
(if you are really using pthreads). If you just need those functions they are inlibrt
so use-lrt
相关问答
更多-
编译了-lpthread时没有引用pthread_mutex_lock(no reference to pthread_mutex_lock with -lpthread compiled)[2022-05-22]
订单很重要,所以使用: gcc prodcon.c -lpthread 或更好: gcc -Wall -Wextra -pedantic -pthread prodcon.c -lpthread 你确定使用pthead_mutex_lock吗? 或者这是一个错字? 无论如何它应该是pthread_mutex_lock 。 对于pthread_mutex_unlock 。 Order matters, so use: gcc prodcon.c -lpthread Or better: gcc -W ... -
如sem_open手册页中所述 : 信号量由名称标识。 由于您的代码为sem_open调用提供了相同的名称值( /mysem ),因此导致引用full和empty的相同信号量。 这显然不是该计划的逻辑应该是什么。 相反,为每个信号打开不同的信号量。 检查所有函数调用的返回值也是最佳做法。 empty = sem_open("/empty_sem", O_CREAT, 0644, BUFFER_SIZE); if (empty == SEM_FAILED) { perror("Failed to o ...
-
是对现代g ++编译器解决的vtable错误的未定义引用?(is the undefined reference to vtable error solved by modern g++ compilers?)[2022-06-24]
您没有正确阅读文档。 有关段落的第一句话说: ISO C ++标准规定,非纯虚拟类的所有虚拟方法都必须定义,但不要求违反此规则的任何诊断[class.virtual] / 8。 所以,预计你可能不会得到一个错误,特别是因为你实际上没有调用test() (尽管在构造函数的输出中存在谎言)。 实际上,只有在下列情况下才可能得到此诊断结果: 你调用一个你没有定义的虚函数 你实例化一个你没有定义virtual析构函数的对象 但请不要误解:无论您的程序是否有未定义的行为, You didn't read the do ... -
编译Error Boost库未定义引用`shm_open'(Compile Error Boost library undefined reference to `shm_open')[2022-05-06]
不要这样做: CFLAGS=-Wall -g -std=c++11 -lpthread -lrt 链接器标志不属于编译行,仅在链接行上。 不要这样做: LDFLAGS = -std = c ++ 11 -lpthread -lrt -std=c++11是一个编译标志,不属于您的链接行。 这个: $(CC) $(LDFLAGS) $(OBJECTS) -o $@ 将库放在链接行的开头。 他们应该在最后 。 这个答案解释了为什么这很重要。 Don't do this: CFLAGS=-Wall -g -std= ... -
我需要同时使用sem_close和sem_unlink 。 在OS X的sem_init中提到了这一点,但我错过了重要性。 这个答案有助于详细说明何时使用每个功能。 总结一下: sem_close只释放信号量使用的资源。 封闭的信号量持续存在,可以重新打开。 sem_unlink标记当所有进程停止使用它时要销毁的信号量。 正如@JohnBollinger在评论中补充的那样, 如果您只需要在一个程序的一次运行期间使用信号量,那么您应该考虑在创建它之后立即取消链接(通过sem_unlink())。 然后,您可以 ...
-
undefined reference to shm_open'意味着它无法为ARM找到-lrt 。 在构建命令行中,您需要指定ARM构建库的包含和库路径,而不是Ubuntu库。 所以-I/usr/include和-L /lib是错误的。 您还需要为ARM构建的boost,但如果您只想使用进程间库,那么boost头应该足够了。 但是你需要将它们复制到不同的位置,因为从/usr/include包含它们/usr/include包括特定于Ubuntu的其他头文件。 您可以使用您提到的交叉编译器IDE或arm g ...
-
用C语言编写的库不太可能在其函数周围有extern "C"保护,但这对C ++代码来说不是问题。 只需自己提供包括: extern "C" { #include
} A library written in C is unlikely to have the extern "C" guard around its functions, but this is not a problem for C++ code. Simply provide it yourself ... -
如何在makefile中包含-std = c ++ 11和-lpthread?(How to include -std=c++11 and -lpthread in makefile?)[2024-01-28]
您的makefile没有用于编译$(OBJS)的对象的明确规则,这意味着将使用隐式规则,这是产生此命令的原因: g++ -c -o clitest.o clitest.cpp 将.cpp文件转换为.o文件的隐式规则大致为: $(CXX) $(CXXFLAGS) -c -o $@ $< 因此,要添加影响该规则的选项,您应该将它们添加到CXXFLAGS变量( CFLAGS通常用于编译C文件, CC是C编译器,C ++编译器的常规变量是CXX )。 -lpthread选项是链接器选项,因此需要在链接期间 ... -
你想要编译选项-pthread (如果你真的使用pthreads)。 如果你只是需要这些函数,它们在librt所以使用-lrt You want the compile option -pthread (if you are really using pthreads). If you just need those functions they are in librt so use -lrt
-
添加-pthread参数以引入所有用于链接的线程化内容 g++ ./main.c -pthread Add the -pthread param to pull in all the threading stuff for linking g++ ./main.c -pthread