这是我想要实现的(一个可修改的多边形,其中红色圆圈是顶点),我想动态构建多边形.
在启动几何体时
var geometry = new THREE.Geometry();
geometry.vertices.push(point);
geometry.vertices.push(point);
var line = new THREE.Line(geometry, new THREE.LineBasicMaterial({}));
Run Code Online (Sandbox Code Playgroud)
它运行良好,直到第二次单击,它在1和2之间构建一条直线,但是当它被推送到数组时不会添加第三条线.WebGL似乎需要缓冲点.
当我预定义像这样的顶点我可以画两条线(第三次点击)
var geometry = new THREE.Geometry();
for (var i = 0; i < 4; i++) {
geometry.vertices.push(point);
}
var line = new THREE.Line(geometry, new THREE.LineBasicMaterial({}));
Run Code Online (Sandbox Code Playgroud)
但这不是一个好的解决方案,因为我不知道用户想要添加多少个顶点,因为我需要多次循环它,所以分配它是没有意义的.
它有什么办法吗?
我正在尝试针对 dockered 数据库运行 dropwizard 的集成测试。
我试过的:
@ClassRule
public static final PostgreSQLContainer postgres = new PostgreSQLContainer();
@ClassRule
public final DropwizardAppRule<Configuration> RULE = new DropwizardAppRule<>(
Application.class,
CONFIG_PATH,
ConfigOverride.config("dataSourceFactory.url", postgres.getJdbcUrl()),
ConfigOverride.config("dataSourceFactory.user", postgres.getUsername()),
ConfigOverride.config("dataSourceFactory.password", postgres.getPassword())
);
Run Code Online (Sandbox Code Playgroud)
我得到 Caused by: java.lang.IllegalStateException: Mapped port can only be obtained after the container is started
将这些链接在一起也不起作用
@ClassRule
public static TestRule chain = RuleChain.outerRule(postgres = new PostgreSQLContainer())
.around(RULE = new DropwizardAppRule<>(
Application.class,
CONFIG_PATH,
ConfigOverride.config("dataSourceFactory.url", postgres.getJdbcUrl()),
ConfigOverride.config("dataSourceFactory.user", postgres.getUsername()),
ConfigOverride.config("dataSourceFactory.password", postgres.getPassword())
));
Run Code Online (Sandbox Code Playgroud)
最后这可行,但据我所知,它为每个测试运行新的 DropwizardAppRule,这并不好......
@ClassRule
public static …
Run Code Online (Sandbox Code Playgroud) 我正在寻找从用户定义的函数进行查询。select
我见过的所有示例都是以参数形式查询函数
myFunction.setMyParam("plapla");
create.select(myFunction.asField()).fetch();
Run Code Online (Sandbox Code Playgroud)
尽管结果实际上是多列,但这会将结果作为一列返回。
我想做的是
myFunction.setMyParam("plapla");
create.select().from(myFunction).fetch();
Run Code Online (Sandbox Code Playgroud)
但我还没有找到办法这样做......
目前我正在使用
DSL.using(create.configuration())
.select()
.from("myFunction('" + myparam + "')")
.fetch();
Run Code Online (Sandbox Code Playgroud)
这似乎不是一个好的解决方案(未转义、未经处理等)
如何使用JOOQ生成的函数来做到这一点?