标签: coordinates

访问现有的UITableViewCell

这是一个不同的问题,但我认为错误并没有错,所以我调整了标题以反映我真正想到的.

我正在制作一个动画,它在普通UITableViewCell的cell.imageView中获取一个图像的副本,并将其移动到屏幕底部的标签栏,以模拟将项目放入购物车.我可以复制图像并将副本作为窗口的子视图放置,但我无法弄清楚如何获得原始图像的绝对位置,因此我可以将它放在顶部作为动画的起点.

图像始终显示在屏幕顶部,就像放在0,0一样.

对不起这个问题的noobish性质,我敢肯定我错过了一些非常明显的东西.

- (void)tableView:(UITableView*)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath*)indexPath {

UITableViewCell *cell = [self tableView:tableView cellForRowAtIndexPath:indexPath];
UIImageView *originalImgView = cell.imageView;
UIImageView *img = [[[UIImageView alloc] initWithImage: cell.imageView.image] autorelease];

NSLog(@"Original %@", originalImgView.bounds);  // Shows "Original (null)" at runtime.
NSLog(@"Window Points %@", [self.view.window convertPoint:originalImgView.frame.origin toView:nil]);
NSLog(@"Cell Points: %@", cell.bounds);  // Shows "Original (null)" at runtime.

[img setFrame:CGRectMake( originalImgView.bounds.origin.x, originalImgView.bounds.origin.y ,
        cell.imageView.image.size.width, cell.imageView.image.size.height)];

[self.view.window addSubview:img];

NSLog(@"Selected Cell: %@", cell); // Shows cell info at run time, works
Run Code Online (Sandbox Code Playgroud)

}

animation uitableview coordinates uiview ios

3
推荐指数
1
解决办法
1147
查看次数

当MKMAPVIEW范围发生变化时会触发什么事件

当MKMAPVIEW更改范围(放大或缩小,平移)时会触发什么事件?

我需要获取用于显示地图的坐标.

xcode coordinates mkmapview

3
推荐指数
1
解决办法
988
查看次数

SVG小组翻译问题

我必须出于特定原因进行小组翻译(SVG).我不知道为什么我不能正确地做到这一点,因为在翻译完成后,在另一个单击组上它会重置开始位置的翻译并让我在SVG画布上乱跑.我在链接上写了准系统示例:http://www.atarado.com/en/stripboard-layout-software/group-translation-problem.svg,这里是代码:

<svg xmlns="http://www.w3.org/2000/svg"
 xmlns:xlink="http://www.w3.org/1999/xlink">
<script><![CDATA[
function startMove(evt){
 x1=evt.clientX;
 y1=evt.clientY;
 group=evt.target.parentNode;
 group.setAttribute("onmousemove","moveIt(evt)");
}
function moveIt(evt){
 dx=evt.clientX-x1;
 dy=evt.clientY-y1;
 group.setAttributeNS(null,"transform","translate("+ dx + ", " + dy +")");
}
function drop(){
 group.setAttributeNS(null, "onmousemove",null);
}
]]></script>
<rect x="0" y="0" width="100%" height="100%" fill="dodgerblue"/>

<g id="BC" transform="translate(0, 0)" onmousedown="startMove(evt)" onmouseup="drop()"><circle id="C" cx="60" cy="60" r="22" fill="lightgrey" stroke="black" stroke-width="8"/><circle id="B" cx="120" cy="60" r="22" fill="orange" stroke="black" stroke-width="8" /></g>
</svg>
Run Code Online (Sandbox Code Playgroud)

欢迎任何愿意提供帮助的人.

svg translation drag-and-drop coordinates coordinate-transformation

3
推荐指数
1
解决办法
2404
查看次数

如何在画布中获得构成圆形的坐标数组?

所以,如果这是我用来在画布上绘制圆圈的代码:

ctx.beginPath();
ctx.arc(centerX, centerY, radius, 0, 2 * Math.PI, false);
ctx.lineWidth = 3;
ctx.strokeStyle = "black";
ctx.stroke();
Run Code Online (Sandbox Code Playgroud)

...我怎么能得到构成这个圆圈的点的坐标数组,这样我就可以将它们保存在数据库中,然后使用context.moveTo()和context.lineTo()方法加载到画布上以连接点,绘制相同的圆圈?

我想我是否可以使用非.arc()方法绘制这种圆,但是如果我只知道我的中心坐标和圆半径(当然还有线和颜色的宽度),可以用点连接点. ).这应该使我能够在循环时保存数组中的每个点坐标.

arrays html5 geometry coordinates html5-canvas

3
推荐指数
1
解决办法
4698
查看次数

获取目标C中两点之间的所有X,Y坐标

如何获得两点之间的所有X,Y坐标.我想在目标C中以对角线模式移动UIButton.示例.将UIButton从位置'Point A'移动到位置'Point B'.

                         .Point B



    . Point A
Run Code Online (Sandbox Code Playgroud)

提前致谢.

iphone geometry objective-c coordinates ios

3
推荐指数
2
解决办法
1503
查看次数

如何操作Python中的笛卡尔坐标?

我有一组基本的笛卡尔坐标,我想用Python操作它们.例如,我有以下框(坐标显示为角):

0,4 --- 4,4

0,0 --- 4,0

我希望能够找到一个以(0,2)开头并转到(4,2)的行.我是否需要将每个坐标分解为单独的X和Y值然后使用基本数学,或者有没有办法将坐标作为(x,y)对处理?例如,我想说:

New_Row_Start_Coordinate = (0,2) + (0,0)
New_Row_End_Coordinate = New_Row_Start_Coordinate + (0,4)
Run Code Online (Sandbox Code Playgroud)

python coordinates cartesian-coordinates

3
推荐指数
1
解决办法
5989
查看次数

如何用现有的xyz数据制作矩阵

我想使用matplotlib.pyplot.pcolormesh绘制深度图。

我有一个xyz文件三列,即x(lat),y(lon),z(dep)。

所有列的长度相等

pcolormesh需要矩阵作为输入。因此,使用numpy.meshgrid,我可以将x和y转换为矩阵:

xx,yy = numpy.meshgrid(x_data,y_data)
Run Code Online (Sandbox Code Playgroud)

这很好用...但是,我不知道如何创建我的深度(z)数据矩阵...如何为我的z_data创建与x_data和y_data矩阵相对应的矩阵?

python numpy matplotlib matrix coordinates

3
推荐指数
1
解决办法
6031
查看次数

如何在不跟踪的情况下仅获取一次用户位置?

在我的Android应用程序中,我需要在单击按钮时gt用户位置.但是,我不需要接收有关其位置的持续更新.

我在stackoverflow上搜索了几个问题,但答案是2 - 3年,所以我想知道,就像Android SDK现在一样,最好的方法是什么.

此外,null如果可能的话,我不想进入该位置.

提前致谢.

android location geolocation coordinates

3
推荐指数
1
解决办法
2889
查看次数

需要在更改下拉菜单上突出显示区域坐标

请在下面查看我的代码。我需要突出显示在下拉选项中选择的那些区域。

<select name="hightlight" multiple>
<option value="20">20</option>
<option value="21">21</option>
<option value="22">22</option>
<option value="23">23</option>
<option value="24">24</option>
<option value="25">25</option>
<option value="26">26</option>
<option value="27">27</option>
<option value="28">28</option>
<option value="29">29</option>
<option value="30">30</option>
</select>



<div class="inner-profile-map1">
                                <img src="images/plot_map.png" alt="" usemap="#Map">                        
                            </div>
                            <map name="Map">
                                <area class="area1 thumbLink area_21" shape="poly" coords="115,315,64,270,103,229,151,273">
                                <area class="area2 thumbLink area_22" shape="poly" coords="155,269,106,225,142,185,191,230">
                                <area class="area3 thumbLink area_21" shape="poly" coords="147,182,182,144,231,187,194,227">
                                <area class="area4 thumbLink area_23" shape="poly" coords="185,140,241,77,267,137,274,145,236,183" >
                                <area class="area5 thumbLink area_20" shape="poly" coords="278,143,270,134,246,75,253,66,315,62,319,131,302,131">
                                <area class="area6 thumbLink area_20" shape="poly" coords="325,129,320,63,368,60,370,126">
                                <area class="area7 thumbLink area_20" shape="poly" coords="375,127,374,60,445,56,422,131,406,127">
                                <area …
Run Code Online (Sandbox Code Playgroud)

javascript jquery area css3 coordinates

3
推荐指数
1
解决办法
126
查看次数

从数百万个GPS坐标中确定COUNTRY的最快方法[R]

我有数百万个GPS坐标,想快速添加一列坐标的国家。

我当前的方法有效,但是非常慢:

library(data.table)

#REPRODUCE DATA
data <- data.table(latitude=sample(seq(47,52,by=0.001), 1000000, replace = TRUE),
                   longitude=sample(seq(8,23,by=0.001), 1000000, replace = TRUE))

#REQUIRED PACKAGES
if (!require("sp")) install.packages("sp")
if (!require("rworldmap")) install.packages("rworldmap")
if (!require("sf")) install.packages("sf")
library(sp)
library(rworldmap)
library(sf)

#CURRENT SLOW FUNCTION
coords2country = function(points,latcol,loncol){  
  countriesSP <- getMap(resolution='low')
  pointsSP <- st_as_sf(points,coords=c(loncol,latcol),crs=4326)
  pointsSP<- as(pointsSP,"Spatial")
  # use 'over' to get indices of the Polygons object containing each point 
  indices = over(pointsSP, countriesSP)
  # return the ADMIN names of each country
  indices$ADMIN  
  #indices$ISO3 # returns the ISO3 code 
  #indices$continent   # returns …
Run Code Online (Sandbox Code Playgroud)

r geospatial coordinates r-sp r-sf

3
推荐指数
1
解决办法
124
查看次数