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

php网站好吗怎么做网页

php网站好吗,怎么做网页,廊坊网站建设-纵横网络+网站,直播平台推荐要求#xff1a;实现地图按比例放大 分析#xff1a;考虑到地图放大过程中需要保留河流道路这些物体的相对位置关系#xff0c;这里选择将河流和道路这些物体的坐标矩阵合并成terrain_matrix并对这个合并后的矩阵进行缩放处理。放大后的矩阵#xff0c;根据矩阵中标记的物…要求实现地图按比例放大 分析考虑到地图放大过程中需要保留河流道路这些物体的相对位置关系这里选择将河流和道路这些物体的坐标矩阵合并成terrain_matrix并对这个合并后的矩阵进行缩放处理。放大后的矩阵根据矩阵中标记的物体位置更新各自物体的放大矩阵。 思路对于地图按比例放大借用图片放大的思路使用最近邻插值的方式填充放大后产生的空隙。 实现 补充大小调整参数self.zoomScale 在 _init_的self.grid初始化之前补充大小调整参数self.zoomScale。_init_函数修改部分的代码如下 def __init__(self, N10, K0, width50, height102,civil_info_exchangeTrue, model_layer-1, is_firedFalse, is_floodTrue, count0):self.warning_UI # 警示信息self.resizeScale3 # parameter using to control the scale of the map在_init_函数中补充地图放大、更新代码 # 将安全通道坐标加载到地图中self.draw_environment(self.pos_exits)# 创建坐标空间self.graph path_finding.create_graph(self)self.combine_matrices()# To rescale the terrain map size after combination.self.resize_matrices(self.resizeScale)self.separate_matrix() # update different object matrix from the resized matrix.地图放大函数resize_matrices的定义 def resize_matrices(self, degree):Resize the terrain and constituent matrices while maintaining aspect ratio.:param degree: New rescaling degree.scaling_factor (degree, degree)# Resize the main terrain matrixself.terrain_matrix zoom(self.terrain_matrix, scaling_factor, order0)# order1 for bilinear interpolation and 0 for nearest-neighbor interpolation.# This change will ensure that your matrices integer values are preserved during the resizing process.放大后更新其他物体的坐标矩阵函数separate_matrix def separate_matrix(self):Separate the combined terrain matrix into individual feature matrices.Each matrix should represent one feature (e.g., river, road) with 1s where the feature existsand 0s where it doesnt.# Identify all unique features in the terrain matrix, excluding 0 (empty)unique_features np.unique(self.terrain_matrix)# Define a mapping from feature codes to the corresponding class attributesfeature_mapping {1: river_matrix,2: road_matrix,3: wall_matrix,4: indoor_matrix,5: exits_matrix,6: pillar_matrix,7: ditch_matrix}# Initialize each matrix as an array of zerosfor matrix_name in feature_mapping.values():setattr(self, matrix_name, np.zeros_like(self.terrain_matrix))# For each feature, populate the corresponding matrixfor feature in unique_features:if feature 0:continue # Skip the empty featurematrix_name feature_mapping.get(feature)if not matrix_name:continue # Skip if the feature is not recognized# Update the corresponding matrix directlyfeature_matrix np.where(self.terrain_matrix feature, 1, 0)setattr(self, matrix_name, feature_matrix)# At this point, each feature matrix (e.g., self.river_matrix) has been updated directly# No need to return anything since were modifying the class attributes directly补充放大后地图的可视化脚本 请与单独的.py文件中运行。 # Its assumed you have executed the following installation command in your local environment: # !pip install datashaderimport datashader as ds import datashader.transfer_functions as tf import pandas as pd# Load and prepare the data from matplotlib import pyplot as pltfile_path G:\\terrain_matrix3.csv data pd.read_csv(file_path)# Calculate the aspect ratio of the original data num_rows, num_cols data.shape # Assuming data is your DataFrame aspect_ratio num_cols / num_rows# Ensure column headers are consistent and represent coordinates or indexing # If headers are numeric: good; if not, you might want to set headers as a range of numbers representing columns data.columns range(len(data.columns))# Resetting the index to turn it into a column for melting data data.reset_index()# Melting the data (now X should be consistently numeric) melted_data data.melt(id_vars[index], var_nameX, value_nameValue) melted_data[Y] melted_data[index] melted_data.drop(columns[index], inplaceTrue)# Convert X and Y to numeric values, coercing errors (i.e., non-numeric values are set as NaN) melted_data[X] pd.to_numeric(melted_data[X], errorscoerce) melted_data[Y] pd.to_numeric(melted_data[Y], errorscoerce)# Handle or remove any rows with NaN if necessary (created by coerce) melted_data.dropna(subset[X, Y], inplaceTrue)# Define the dimensions for the canvas plot_width 800 plot_height int(plot_width / aspect_ratio) # Maintain the aspect ratio of the original data# Set up the canvas with the correct aspect ratio canvas ds.Canvas(plot_widthplot_width, plot_heightplot_height)# Aggregating data into a grid agg canvas.points(melted_data, X, Y, ds.mean(Value))# Creating an image by coloring the aggregated data img tf.shade(agg, cmap[lightblue, darkblue], howlinear)# Convert the Datashader image to a format that can be displayed by matplotlib img_to_plot tf.shade(agg, cmap[lightblue, darkblue], howlinear) img_plt tf.set_background(img_to_plot, white)# Display the image using matplotlib plt.imshow(img_plt.to_pil()) plt.axis(off) # Optional: this removes the axes for a cleaner look plt.title(Presentation of the rescaling map data(3X).)plt.show()以下是可视化脚本的输出案例。其中2X和3X分别表示设置的地图放大倍数。
http://www.zqtcl.cn/news/441860/

相关文章:

  • 个人账号如何注册网站广州专业网站改版设计公司
  • wordpress视频网站采集沈阳建设工程质量检测中心网站
  • 做网站优化哪家好远程管理wordpress站群
  • 实用写作网站做企业策划的公司
  • 如何建立自己手机网站58招聘网站官网
  • 网站程序源码下载网站怎么做定位功能
  • 深圳vi设计公司联系西安seo诊断
  • 老虎淘客系统可以做网站吗绍兴网站专业制作
  • 小公司做网站需要 align center
  • 自己做的网站怎么上传网络什么网站可以找人做系统
  • 公司在兰州要做网站怎样选择做期货关注什么网站
  • 响应式网站是指自适应吗新开传奇网站首区
  • 做网站产品介绍wordpress 参数 传递
  • 网站颜色搭配技巧建设摩托车价格大全
  • 哪些网站可以做画赚钱宁波模板建站定制
  • 昆明门户网站建设wordpress权限设置
  • 设计网站建设图片wordpress博客置顶
  • 网站上海网站建设网站数据建设涉及哪些内容
  • 3d效果图教程网站宁波网站建设慕枫科技
  • 视频结交网站怎么做想创建一个网站
  • 电商网站销售数据分析上海企业信息登记号查询
  • 网站建设规划设计公司排名无锡网站建设 君通科技
  • 徐州网站开发要多少钱给个人网站做百度百科
  • 法语网站建设免费网站为何收录比较慢
  • 品牌网站推广软件seo内链优化
  • 广东律师事务所东莞网站建设做网站 怎么备案
  • shopnc本地生活o2o网站源码wordpress文章内多页效果
  • 深圳全国网站制作哪个好页面设计有哪几种风格
  • 网页设计作业网站素材和效果图夏天做啥网站致富
  • 利用帝国软件如何做网站网站友链交换平台