标签: transform

使用两个数组创建地图

我正在尝试使用两个数组创建地图。这是代码:

#include <algorithm>
#include <iostream>
#include <map>
#include <utility>
#include <iterator>
#include <string>
using namespace std;
using std::transform;
int main(){
    const char* word[]={"A","B","C","D","E"};
    const char * clue[]={"a","b","c","d","e"};
    map<string,string>dictionary;
    map<string,string>::iterator it;
    transform(word, word+sizeof(word)/sizeof(word[0]), clue,
              inserter(dictionary,dictionary.end()), make_pair<string,string>);

    for (it=dictionary.begin(),it!=dictionary.end();it++)
        cout<<it->first<< " "<<it->second<<endl;
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

但这里有一些错误:

1>------ Build started: Project: map_array, Configuration: Debug Win32 ------
1>Build started 8/21/2010 4:27:25 PM.
1>PrepareForBuild:
1>  Creating directory "c:\users\david\documents\visual studio 2010\Projects\map_array\Debug\".
1>InitializeBuildStatus:
1>  Creating "Debug\map_array.unsuccessfulbuild" because "AlwaysCreate" was specified.
1>ClCompile:
1>  map_array.cpp
1>c:\users\david\documents\visual studio 2010\projects\map_array\map_array\map_array.cpp(16): error …
Run Code Online (Sandbox Code Playgroud)

c++ templates transform visual-c++

5
推荐指数
1
解决办法
3257
查看次数

尝试使用 PHP 的 GD 库倾斜图像

我一直在到处寻找,尝试找到一个使用 GD 库使用 php 来倾斜图像的函数。我读过建议使用 ImageMagick 的线程,但不幸的是我无法访问我的服务器上的该库,所以我被迫使用 GD。我正在寻找可以指定源图像和目标图像,然后为图像的每个角指定 4 组 X 和 Y 坐标的东西。所以像这样的东西是理想的:

bool skewImage(resource $src_im, resource $dst_im, int $x1, int $y1, int $x2, int $y2, int $x3, int $y3, int $x4, int $y4)
Run Code Online (Sandbox Code Playgroud)

如果有人拥有或知道这样或类似的功能那就太棒了,谢谢!

php gd image transform skew

5
推荐指数
1
解决办法
3034
查看次数

在查找上转换 MongoDB 数据

是否可以转换 MongoDB 中查找查询返回的数据?

例如,我有一个firstandlast字段来存储用户的名字和姓氏。在某些查询中,我希望仅返回名字和姓氏首字母(例如“Joe Smith”返回为“Joe S”)。在 MySQL 中,SUBSTRING()可以在语句中的字段上使用函数SELECT

Mongo 中是否有像 SQL 中那样的数据转换或字符串函数?如果是这样,请提供一个使用示例。如果没有,除了循环返回的对象之外,是否还有建议的方法来转换数据?

string transform function mongodb

5
推荐指数
1
解决办法
6478
查看次数

如何控制css3动画旋转方向

我想用css3动画和transform属性旋转一个元素,从20度到-20度

@-moz-keyframes oneRotate{
    0%{
        -moz-transform: rotate(20deg);
    }
    100%{
        -moz-transform:rotate(-20deg);
    }
}

.oneRotate
{
    -moz-transform-style: preserve-3d;

   -moz-animation-name:oneRotate;
   -moz-animation-duration:2s;
   -moz-animation-timing-function:ease-in-out;
   -moz-animation-delay:0s;
   -moz-animation-iteration-count:infinite;
   -moz-animation-direction:normal;
}
Run Code Online (Sandbox Code Playgroud)

旋转顺序为 20 -> 0 -> -20... 逆时针

但我想要的顺序是 20 -> 90 -> 180 -> ...是顺时针

我可以做什么来实现这一目标?

css animation transform rotation direction

5
推荐指数
1
解决办法
1万
查看次数

变换:使用视口单位缩放

我想使用一个 transform: scale 我的宽度变成 80vw 并且我的高度是自动的。所以这就是我想要的 = transform: scale(80vw, auto);。不幸的是,这不起作用。有没有另一种方法可以获得这种效果。最好不使用javascript。

css transform viewport-units

5
推荐指数
1
解决办法
1946
查看次数

Leaflet自定义图标标记旋转角度,transform风格冲突

我用以下演示重现了这个问题:http : //jsfiddle.net/baoqger/deL0yuvg/9/

在我的项目中,我有一个自定义图标标记,我想在某些情况下旋转图标。

我在创建图标时添加了一个 claasname:

const uturnIcon = L.icon({
  iconUrl: 'http://joshuafrazier.info/images/firefox.svg',
  iconSize: [30, 30],
  className: 'u-turn-icon'
})
Run Code Online (Sandbox Code Playgroud)

并为该类添加 css 样式,如下所示:

.u-turn-icon {
  transform: rotate(20deg) !important
}
Run Code Online (Sandbox Code Playgroud)

问题是默认情况下,图标img有一个style属性transform: translate3d,所以默认的transform和我添加的transform样式有冲突。并且默认的变换样式是由传单本身创建的,当我们缩放地图时,该属性的值也会更新。

那么如何解决这个问题呢?

icons transform marker leaflet

5
推荐指数
1
解决办法
3389
查看次数

Css 将 div 旋转 180 度

我有一个矩形 div,我想在某些情况下旋转 180 度。

我正在使用 css 变换属性来旋转 div。

这在 chrome 上效果很好,但在边缘发生的情况是 div 超出了它的容器 div。我希望 div 本身处于其原始位置,但旋转了 180 度。

.container {
  display: flex, flex-direction: row, align-items: center, justify-content: flex-end, writing-mode: vertical-lr width:100px, height:100px, border: solid red 1px;
}

.rotate {
    transform: rotate(180deg); 
    transform-origin: left top
}
Run Code Online (Sandbox Code Playgroud)
<div class="container">
  <div class="rotate">
    Hello
  </div>
</div>
Run Code Online (Sandbox Code Playgroud)

html css transform

5
推荐指数
2
解决办法
2万
查看次数

如何将 vector&lt;pair&lt;string, int&gt;&gt; 中的字符串复制到 vector&lt;string&gt;?

我正在使用 GCC 9.2.0 并提升 1.55。

我有两个向量:

vector< pair< string, int > > source;
vector< string > dest;
Run Code Online (Sandbox Code Playgroud)

我需要将source向量转换为dest,这样它应该只包含向量的string元素source

是否可以使用boost::push_back和适配器?

boost::range::push_back( dest, source | /* adaptor ??? */ );
Run Code Online (Sandbox Code Playgroud)

目前我有这个可行的代码,但它应该改变:

transform( source.begin(), source.end(), back_inserter(dest), __gnu_cxx::select1st< std::pair< std::string, int > >() );
Run Code Online (Sandbox Code Playgroud)

c++ boost transform vector push-back

5
推荐指数
1
解决办法
99
查看次数

带有 CSS 转换的 Safari 渲染错误 - 深度排序/z-index 问题?(适用于 Chrome)

对于我的网站,我正在使用这个螺旋动画: Codepen

这是它在 Chrome 中的样子(应该是这样):

这就是它在 Safari 中的样子:

css 转换在谷歌浏览器中看起来很棒,但在 Safari 中它坏了。

我尝试了以下(如其他论坛/线程中所述),但没有成功:

transform: translateZ(0px);
transform-style: flat;
transform: translate3d(0,0,0);
Run Code Online (Sandbox Code Playgroud)

以下是一些类似/相关的问题。但是经过数小时的搜索,我没有找到任何解决方案(是的,我尝试了我找到的所有答案):

相关错误?

我的代码基于这个博客:https : //codemyui.com/spiral-banner-text-animation-using-pure-css/


这是代码(与此处Codepen相同)

html:

<ul> …
Run Code Online (Sandbox Code Playgroud)

css safari transform z-index

5
推荐指数
1
解决办法
371
查看次数

Pandas Group By 的奇怪行为 - 转换字符串列

我在使用 Pandas .groupby().transform() 时遇到了一个奇怪的行为。下面是生成数据集的代码:

df = pd.DataFrame({"Name" : ["Alice", "Bob", "Mallory", "Mallory", "Bob" , "Mallory"] ,
                   "Random_Number": [1223344, 373293832, 32738382392, 7273283232, 8239329, 23938832],
                   "City" : ["Seattle", "Seattle", "Portland", "Seattle", "Seattle", "Portland"]})
Run Code Online (Sandbox Code Playgroud)

这是我为transform() 编写的函数。

# this function will attach each value in string col with the number of elements in the each city group
# if the col type is not an object, then return 0 for all rows. 

def some(x): 
    if x.dtype == 'object':
        return x + …
Run Code Online (Sandbox Code Playgroud)

python transform pandas

5
推荐指数
1
解决办法
114
查看次数