当前位置: 首页 > wzjs >正文

网站后台怎么上传网页模板网站以个人名义备案

网站后台怎么上传网页模板,网站以个人名义备案,如何做商业网站,可遇公寓网站哪个公司做的从俯视图到主视图就这两条线有问题,比想象的效果好 原图 两条斜线变成了4条横线 经典少一根线 好了但是不知道为什么好了 import { Logger, PubSub } from "chili-core"; import DxfParser, { ILineEntity } from dxf-parser; class Cluster {lines: [num…

从俯视图到主视图就这两条线有问题,比想象的效果好

原图

两条斜线变成了4条横线

经典少一根线

好了但是不知道为什么好了

import { Logger, PubSub } from "chili-core";
import DxfParser, { ILineEntity } from 'dxf-parser';
class Cluster {lines: [number, number, number, number][];min_x: number;max_x: number;min_y: number;max_y: number;constructor(lines: [number, number, number, number][] = []) {this.lines = [...lines];this.min_x = Infinity;this.max_x = -Infinity;this.min_y = Infinity;this.max_y = -Infinity;if (lines.length > 0) {this.updateBounds();}}updateBounds(): void {this.min_x = Math.min(...this.lines.flatMap(line => [line[0], line[2]]));this.max_x = Math.max(...this.lines.flatMap(line => [line[0], line[2]]));this.min_y = Math.min(...this.lines.flatMap(line => [line[1], line[3]]));this.max_y = Math.max(...this.lines.flatMap(line => [line[1], line[3]]));}get lengthX(): number {return parseFloat((this.max_x - this.min_x).toFixed(1));}get lengthY(): number {return parseFloat((this.max_y - this.min_y).toFixed(1));}
}
function clusterLines(lines: [number, number, number, number][], expandDistance: number = 5): Cluster[] {const clusters: Cluster[] = [];const remainingLines = [...lines];while (remainingLines.length > 0) {const seed = remainingLines.shift()!;const currentCluster = new Cluster([seed]);currentCluster.updateBounds();let changed = true;while (changed) {changed = false;const expandedMinX = currentCluster.min_x - expandDistance;const expandedMaxX = currentCluster.max_x + expandDistance;const expandedMinY = currentCluster.min_y - expandDistance;const expandedMaxY = currentCluster.max_y + expandDistance;const toAdd: [number, number, number, number][] = [];for (const line of [...remainingLines]) {const [x1, y1, x2, y2] = line;const inBound =(x1 >= expandedMinX && x1 <= expandedMaxX && y1 >= expandedMinY && y1 <= expandedMaxY) ||(x2 >= expandedMinX && x2 <= expandedMaxX && y2 >= expandedMinY && y2 <= expandedMaxY);if (inBound) {toAdd.push(line);changed = true;}}for (const line of toAdd) {currentCluster.lines.push(line);remainingLines.splice(remainingLines.indexOf(line), 1);}currentCluster.updateBounds();}// 合并完全覆盖的聚类for (let i = 0; i < clusters.length; i++) {const cluster = clusters[i];if (currentCluster.min_x <= cluster.min_x &&currentCluster.min_y <= cluster.min_y &&currentCluster.max_x >= cluster.max_x &&currentCluster.max_y >= cluster.max_y) {currentCluster.lines.push(...cluster.lines);clusters.splice(i, 1);break;}}clusters.push(currentCluster);}return clusters;
}
export function rebuild3D(document: Document) {const fileInput = document.createElement("input");fileInput.type = "file";fileInput.accept = ".dxf";fileInput.style.display = "none";fileInput.addEventListener("change", async (event) => {const target = event.target as HTMLInputElement;if (!target.files || target.files.length === 0) return;const file = target.files[0];Logger.info(`Selected file: ${file.name}`);try {const reader = new FileReader();reader.onload = () => {const dxfText = reader.result as string;const parser = new DxfParser();const dxf = parser.parseSync(dxfText);const inputlines: [number, number, number, number][] = [];if (dxf && dxf.entities) {dxf.entities.forEach(entity => {if (entity.type === 'LINE') {const lineEntity = entity as ILineEntity;const start = lineEntity.vertices[0];const end = lineEntity.vertices[1];if (start && end) {inputlines.push([start.x, start.y, end.x, end.y]);}}});}// 执行聚类const clusters = clusterLines(inputlines, 5);const lines3d:[number,number,number,number,number,number,number][]=[]const { mostMinX, mostMinY } = getMostFrequentMinXY(clusters);const mostFrequentClusters = clusters.filter(cluster => {return cluster.min_x === mostMinX.value && cluster.min_y === mostMinY.value;
});
const topclusters = clusters.filter(cluster => {return cluster.min_x === mostMinX.value && cluster.min_y > mostMinY.value;
});
;
const rightclusters = clusters.filter(cluster => {return cluster.min_x > mostMinX.value && cluster.min_y === mostMinY.value;
});
const bottomclusters = clusters.filter(cluster => {return cluster.min_x === mostMinX.value && cluster.min_y < mostMinY.value;
});
const leftclusters = clusters.filter(cluster => {return cluster.min_x < mostMinX.value && cluster.min_y === mostMinY.value;
});const mostFrequentCluster= mostFrequentClusters[0];const topcluauster= topclusters[0];const rightcluster= rightclusters[0];const bottomcluster= bottomclusters[0];const leftcluster= leftclusters[0];const seen = new Set<string>(); // 用于记录已经添加过的线段function addUniqueLine(x1: number, y1: number, z1: number, x2: number, y2: number, z2: number,color:number) {const key = `${x1},${y1},${z1},${x2},${y2},${z2}`;if (!seen.has(key)) {seen.add(key);lines3d.push([x1, y1, z1, x2, y2, z2,color]);}
} 
const clusterMinY = topcluauster.min_y;// 构建点存在性查询的 Map
const pointToLinesMap = new Map<string, boolean>();
topcluauster.lines.forEach(([tx1, ty1, tx2, ty2]) => {pointToLinesMap.set(`${tx1},${ty1}`, true);pointToLinesMap.set(`${tx2},${ty2}`, true);
});// 判断某点是否存在于 topcluauster 中
function isPointInTopCluster(x: number, y: number): boolean {return pointToLinesMap.has(`${x},${y}`);
}// 主处理逻辑
for (const [x1, y1, x2, y2] of mostFrequentCluster.lines) {for (const [tx1, ty1, tx2, ty2] of topcluauster.lines) {// 判断 (x1, ty1) 和 (x2, ty2) 是否在 topcluauster 的线段中const p1Exists = isPointInTopCluster(x1, ty1);const p2Exists = isPointInTopCluster(x2, ty2);const offset1 = ty1 - clusterMinY;const offset2 = ty2 - clusterMinY;if (p1Exists && p2Exists) {if(x1==x2&&x1==tx1){addUniqueLine(x1, y1, offset1, x2, y2, offset1, 1);}else if(x1==x2&&x1==tx2){addUniqueLine(x1, y1, offset2, x2, y2, offset2, 1);}else if(x1==tx1&&x2==tx2){ addUniqueLine(x1, y1, offset1, x2, y2, offset2, 1);}}if (ty1 !== ty2 && (x1 === tx1 && tx1 === tx2 )) {addUniqueLine(x1, y1, offset1, x1, y1, offset2, 1);}if (ty1 !== ty2 && ( x2 === tx1 && tx1 === tx2)) {addUniqueLine(x2, y2, offset1, x2, y2, offset2, 1);}}
}
Logger.info(`lines3d completed with ${lines3d.length} lines3d`);lines3d.forEach(line => {PubSub.default.pub("njsgcs_makeline", line[0], line[1],  line[2], line[3], line[4], line[5],1); })///// let i =0;// // 发送每个线段给 njsgcs_makeline// clusters.forEach(cluster => {//     i++;//     cluster.lines.forEach(line => {//         const [x1, y1, x2, y2] = line;//         PubSub.default.pub("njsgcs_makeline", x1, y1, 0, x2, y2, 0,i); // z=0 假设为俯视图//     });// });///Logger.info(`Clustering completed with ${clusters.length} clusters`);};reader.readAsText(file);} catch (error) {Logger.error("Error reading file:", error);}});fileInput.click();
}
function getMostFrequentMinXY(clusters: Cluster[]) {const minXCounts: Record<number, number> = {};const minYCounts: Record<number, number> = {};let maxXCount = 0, mostX = clusters[0]?.min_x;let maxYCount = 0, mostY = clusters[0]?.min_y;for (const cluster of clusters) {const x = cluster.min_x;const y = cluster.min_y;minXCounts[x] = (minXCounts[x] || 0) + 1;if (minXCounts[x] > maxXCount) {maxXCount = minXCounts[x];mostX = x;}minYCounts[y] = (minYCounts[y] || 0) + 1;if (minYCounts[y] > maxYCount) {maxYCount = minYCounts[y];mostY = y;}}return {mostMinX: { value: mostX, count: maxXCount },mostMinY: { value: mostY, count: maxYCount }};
}


文章转载自:

http://70t36ENg.rfwkn.cn
http://SiR1pO3T.rfwkn.cn
http://7FemHFc7.rfwkn.cn
http://zXdbPfIs.rfwkn.cn
http://YyHe441N.rfwkn.cn
http://e4DM0C7c.rfwkn.cn
http://DXVLUpd5.rfwkn.cn
http://Gjw1Rv3W.rfwkn.cn
http://JGluyIGy.rfwkn.cn
http://K4mfXT5S.rfwkn.cn
http://HZwE2077.rfwkn.cn
http://XF7Thnhz.rfwkn.cn
http://aUcSQMkU.rfwkn.cn
http://ThRCXXyd.rfwkn.cn
http://RUtt0XgL.rfwkn.cn
http://FHgPJosC.rfwkn.cn
http://dBIhCeT5.rfwkn.cn
http://8dcck51m.rfwkn.cn
http://3hZk9ZXl.rfwkn.cn
http://GqVyjRPi.rfwkn.cn
http://NE0deSuj.rfwkn.cn
http://pluQ0E3l.rfwkn.cn
http://lZ0CHiGy.rfwkn.cn
http://BTqprs8J.rfwkn.cn
http://fTXR7cfH.rfwkn.cn
http://AFaKUpn3.rfwkn.cn
http://qlMS2jXi.rfwkn.cn
http://PJmw15u0.rfwkn.cn
http://ArWu8rJb.rfwkn.cn
http://30nN1Jvu.rfwkn.cn
http://www.dtcms.com/wzjs/775974.html

相关文章:

  • 攀枝花建设规划网站自定义功能的网站
  • 四川省示范校建设网站广西住房和建设厅官网
  • 网站界面用什么做wordpress woocommerce 主题
  • 杭州网站建设费用多少钱建设移动门户
  • 自己有了域名 怎么做网站网站建设5000费用
  • 阿里云里面网站建设注册网站域名的作用
  • 百度做的网站 如果不做推广了 网站还保留吗传播易广告投放平台
  • 建设路第3小学网站电话常德今天最新通告
  • jsp网站模版搜索引擎营销的特点包括
  • 杭州网站建设哪家权威成都企业建站模板
  • 免费的网站软件正能量广东网广东网站建设
  • 学风建设网站诸暨有哪些好网站制作公司
  • 怎样学习做网站的编程Wordpress 微博 链接
  • 做软件赚钱还是做网站赚钱公司网站建设模块
  • 海林建设局网站网站编辑做图片用什么不同
  • 单屏网站设计纵横天下营销型网站建设
  • 备案修改网站名称页面首页wordpress
  • 南宁网站推广流程六安事件最新情况
  • 网站内部优化策略wordpress 验证码
  • 网站建设服务器租用wordpress 不显示首页
  • 东莞网站制作的方案哪里有网站推广软件
  • 长治一般做一个网站需要多少钱wordpress4.5 ueditor 1.4.3
  • 有域名和空间怎么做网站响应式wordpress模板下载
  • 一个人做网站要多久wordpress用户部门
  • 哪里有做响应式网站的app推广代理加盟
  • 上海的网站名潮州市网站建设公司
  • 宁波网站制作费用域名检测
  • 网站建设 总体目标企查查企业信息查询在线查询
  • 一个完整的网站制作流程金融企业如何做好网络推广
  • 网站建设哪些模板号网站建设服务网络服务