Android Gantt View 安卓实现项目甘特图

需要做一个项目管理工具,其中使用到了甘特图。发现全网甘特图解决方案比较少,于是自动动手丰衣足食。

前面我用 Python和 Node.js 前端都做过,这次仅仅是移植到 Android上面。

其实甘特图非常简单,开发也不难,如果我专职去做,能做出一个非常棒产品。我写这个只是消遣,玩玩,闲的蛋痛,所以不怎么上心,就搞成下面这德行吧。仅仅供大家学习,参考。

那天心情好了,完善一下。

屏幕布局文件

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"xmlns:app="http://schemas.android.com/apk/res-auto"xmlns:tools="http://schemas.android.com/tools"android:layout_width="match_parent"android:layout_height="match_parent"><ScrollViewandroid:layout_width="match_parent"android:layout_height="match_parent"></ScrollView><HorizontalScrollViewandroid:layout_width="match_parent"android:layout_height="match_parent"><cn.netkiller.gantt.ui.GanttViewandroid:layout_width="wrap_content"android:layout_height="match_parent"android:background="#DEDEDE"android:keepScreenOn="true"android:padding="15dp"android:text="TextView" /></HorizontalScrollView></androidx.constraintlayout.widget.ConstraintLayout>

View 代码

package cn.netkiller.gantt.ui;import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Point;
import android.graphics.drawable.Drawable;
import android.text.TextPaint;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;/*** TODO: document your custom view class.*/
public class GanttView extends View {private final String TAG = GanttView.class.getSimpleName();private Drawable mExampleDrawable;private int contentWidth, contentHeight;private int paddingLeft, paddingTop, paddingRight, paddingBottom;private int canvasLeft, canvasTop, canvasRight, canvasBottom;private Canvas canvas;private int textSize;private Map<Date, Coordinate> coordinates = new HashMap<Date, Coordinate>();public static class Coordinate {public int x, y;public Coordinate(int x, int y) {this.x = x;this.y = y;}public int getX() {return x;}public void setX(int x) {this.x = x;}public int getY() {return y;}public void setY(int y) {this.y = y;}@Overridepublic String toString() {return "Coordinate{" +"x=" + x +", y=" + y +'}';}}public GanttView(Context context) {super(context);init(null, 0);}public GanttView(Context context, AttributeSet attrs) {super(context, attrs);init(attrs, 0);}public GanttView(Context context, AttributeSet attrs, int defStyle) {super(context, attrs, defStyle);init(attrs, defStyle);}private void init(AttributeSet attrs, int defStyle) {paddingLeft = getPaddingLeft();paddingTop = getPaddingTop();paddingRight = getPaddingRight();paddingBottom = getPaddingBottom();contentWidth = getWidth() - paddingLeft - paddingRight;contentHeight = getHeight() - paddingTop - paddingBottom;// Load attributes
//        final TypedArray a = getContext().obtainStyledAttributes(
//                attrs, R.styleable.MyView, defStyle, 0);
//mExampleString = a.getString(R.styleable.MyView_exampleString);
//        mExampleString = "AAAA";
//        mExampleColor = a.getColor(
//                R.styleable.MyView_exampleColor,
//                mExampleColor);
//        // Use getDimensionPixelSize or getDimensionPixelOffset when dealing with
//        // values that should fall on pixel boundaries.
//        mExampleDimension = a.getDimension(
//                R.styleable.MyView_exampleDimension,
//                mExampleDimension);
//
//        if (a.hasValue(R.styleable.MyView_exampleDrawable)) {
//            mExampleDrawable = a.getDrawable(
//                    R.styleable.MyView_exampleDrawable);
//            mExampleDrawable.setCallback(this);
//        }
//
//        a.recycle();}//    @Override
//    protected void onSizeChanged(int w, int h, int oldw, int oldh) {
//        super.onSizeChanged(w, h, oldw, oldh);
//if (h < computeVerticalScrollRange()) {canScroll = true;} else {canScroll = false;}
//    }public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {super.onMeasure(widthMeasureSpec, heightMeasureSpec);setMeasuredDimension(contentWidth, contentHeight);}
//
//    private boolean canScroll = true;
//
//    @Override
//    protected void onSizeChanged(int w, int h, int oldw, int oldh) {
//        super.onSizeChanged(w, h, oldw, oldh);
//
//        if (h < computeVerticalScrollRange()) {
//            canScroll = true;
//        } else {
//            canScroll = false;
//        }
//    }List<Data> taskList = List.of(new Data("AAA", "2024-06-28", "2024-07-04", "1", "Neo"),new Data("AAABBB", "2024-06-15", "2024-06-20", "10", "Neo"),new Data("AAACC", "2024-06-25", "2024-06-27", "1", "Neo"),new Data("AAABBCCD", "2024-06-25", "2024-06-28", "1", "Neo"),new Data("消息推送", "2024-01-15", "2024-06-30", "1", "Neo"),new Data("AAA", "2024-06-05", "2024-07-12", "1", "Neo"),new Data("AAA", "2024-06-05", "2024-07-17", "1", "Neo"),new Data("AAA", "2024-06-15", "2024-07-07", "1", "Neo"),new Data("AAA", "2024-06-18", "2024-07-02", "1", "Neo"),new Data("AAA", "2024-06-05", "2024-07-05", "1", "Neo"));@Overrideprotected void onDraw(Canvas canvas) {super.onDraw(canvas);this.canvas = canvas;canvasTop = paddingTop;canvasLeft = paddingLeft;canvasRight = canvas.getWidth() - paddingRight;canvasBottom = canvas.getHeight() - paddingBottom;Paint paint = new Paint();paint.setStyle(Paint.Style.STROKE);paint.setColor(Color.BLUE);paint.setStrokeWidth(2);canvas.drawRect(0, 0, getWidth(), getHeight(), paint);paint.setColor(Color.DKGRAY);paint.setStyle(Paint.Style.FILL_AND_STROKE);paint.setAlpha(30);canvas.drawRect(canvasLeft, canvasTop, canvasRight, canvasBottom, paint);title("canvas");try {calendar("2024-06-12", "2024-07-20");tasks(taskList);} catch (Exception e) {}// Draw the example drawable on top of the text.if (mExampleDrawable != null) {mExampleDrawable.setBounds(paddingLeft, paddingTop,paddingLeft + contentWidth, paddingTop + contentHeight);mExampleDrawable.draw(canvas);}}public Map<String, Float> colume(List<Data> taskList) {TextPaint textPaint = new TextPaint();textPaint.setTextSize(sp2px(20));float name = textPaint.measureText("任务");float start = textPaint.measureText("开始日期");float finish = textPaint.measureText("截止日期");float day = textPaint.measureText("工时");float resource = textPaint.measureText("资源");for (Data data : taskList) {float textWidth = textPaint.measureText(data.name);if (textWidth > name) {name = textWidth;}if (textPaint.measureText(data.start) > start) {start = textPaint.measureText(data.start);}if (textPaint.measureText(data.finish) > finish) {finish = textPaint.measureText(data.finish);}if (textPaint.measureText(data.day) > day) {day = textPaint.measureText(data.day);}if (textPaint.measureText(data.resource) > resource) {resource = textPaint.measureText(data.resource);}}float finalName = name;float finalStart = start;float finalResource = resource;float finalFinish = finish;float finalDay = day;return new LinkedHashMap<String, Float>() {{put("任务", finalName);put("开始日期", finalStart);put("截止日期", finalFinish);put("工时", finalDay);put("资源", finalResource);}};}private int titleHeight;public float sp2px(float spValue) {//fontScale (DisplayMetrics类中属性scaledDensity)final float fontScale = getResources().getDisplayMetrics().scaledDensity;return (spValue * fontScale + 0.5f);}private void title(String value) {// Draw the text.TextPaint textPaint = new TextPaint();textPaint.setFlags(Paint.ANTI_ALIAS_FLAG);textPaint.setTextAlign(Paint.Align.LEFT);textPaint.setTextSize(sp2px(25));float textWidth = textPaint.measureText(value);Paint.FontMetrics fontMetrics = textPaint.getFontMetrics();
//        float textHeight = fontMetrics.bottom;float textHeight = textPaint.getFontSpacing();canvas.drawText(value,canvasLeft + (getWidth() - textWidth) / 2,canvasTop + textHeight,textPaint);textPaint.setTextSize(sp2px(18));String copyright = "https://www.netkiller.cn - design by netkiller";textWidth = textPaint.measureText(copyright);textHeight += textPaint.getFontSpacing();canvas.drawText(copyright,getWidth() - textWidth - canvasLeft,canvasTop + textHeight,textPaint);titleHeight = (int) textHeight;}private void process(String string, int x, int y, int size) {TextPaint mTextPaint = new TextPaint();mTextPaint.setTextSize(sp2px(size));
//        mTextWidth = mTextPaint.measureText(string);
//        Paint.FontMetrics fontMetrics = mTextPaint.getFontMetrics();
//        mTextHeight = fontMetrics.bottom;}private int tableEnd = 0;//    private void table() {
//
//TextPaint textPaint = new TextPaint();
//        calendarTextPaint.setTextSize(sp2px(20));
//
//        Paint.FontMetrics fontMetrics = calendarTextPaint.getFontMetrics();
//        float fontSpacing = calendarTextPaint.getFontSpacing();mTextHeight = fontMetrics.bottom;
//        int textX = canvasLeft + (int) fontSpacing / 2;
//        int textY = canvasTop + (int) fontSpacing * 3 + titleHeight;
//
//        int startX = 0;
//        int startY = (int) (canvasTop + titleHeight + fontSpacing * 2);
//        int stopX = startX;
//        int stopY = canvasBottom;
//
//        for (String text : List.of("任务", "开始日期", "截止日期", "工时", "资源")) {
//            canvas.drawText(text, textX, textY, calendarTextPaint);
//            textX += (int) (calendarTextPaint.measureText(text) + fontSpacing);
//            startX = stopX = textX;
//            canvas.drawLine(startX - (fontSpacing / 2), startY, stopX - (fontSpacing / 2), stopY, calendarPaint);
//        }
//        tableEnd = (int) (startX - (int) fontSpacing - fontSpacing / 2);
//
//    }private void table() {//        TextPaint textPaint = new TextPaint();calendarTextPaint.setTextSize(sp2px(20));//        Paint.FontMetrics fontMetrics = calendarTextPaint.getFontMetrics();float fontSpacing = calendarTextPaint.getFontSpacing();
//        mTextHeight = fontMetrics.bottom;int tableLeft = canvasLeft;int tableTop = canvasTop + (int) fontSpacing * 2 + titleHeight;int tableRight = canvasRight;int tableBottom = canvasBottom;int textX = tableLeft;int textY = tableTop + calendarFontSpacing;int startX = tableLeft;int startY = tableTop;int stopX = startX;int stopY = tableBottom;for (Map.Entry<String, Float> entry : colume(taskList).entrySet()) {String text = entry.getKey();Float textWidth = entry.getValue();canvas.drawText(text, textX + (int) fontSpacing / 2, textY, calendarTextPaint);textX += (int) (textWidth + calendarFontSpacing);startX += (int) (textWidth + calendarFontSpacing);stopX = startX;canvas.drawLine(startX, startY, stopX, stopY, calendarPaint);}tableEnd = tableRight = (int) (startX - calendarFontSpacing / 2);}private void tasks(List<Data> taskList) throws ParseException {Paint paint = new Paint();paint.setStyle(Paint.Style.FILL);paint.setColor(Color.BLUE);paint.setStrokeWidth(2);//        TextPaint textPaint = new TextPaint();
//        calendarPaint.setColor(Color.DKGRAY);calendarPaint.setColor(Color.GRAY);calendarTextPaint.setTextSize(sp2px(20));int taskTop = calendarTop + calendarFontSpacing * 3;int taskLeft = canvasLeft;int taskRight = tableEnd;int taskBottom = canvasBottom;//        Paint.FontMetrics fontMetrics = calendarTextPaint.getFontMetrics();
//        float fontSpacing = calendarTextPaint.getFontSpacing();int textX = 0;int textY = taskTop + calendarFontSpacing;int startX = 0;int startY = taskTop;int stopX = startX;int stopY = taskTop + calendarFontSpacing;//        canvas.drawLine(startX, calendarTop + calendarFontSpacing * 1, calendarRight, calendarTop + calendarFontSpacing * 1, calendarPaint);
//        canvas.drawLine(startX, startY - calendarFontSpacing, startX, stopY, calendarTextPaint);Map<String, Float> col = colume(taskList);Log.d(TAG, col.toString());for (Data task : taskList) {textX = taskLeft + (int) calendarFontSpacing / 2;Iterator<Float> aa = col.values().iterator();for (String text : List.of(task.name, task.start, task.finish, task.day, task.resource)) {Float textWidth = aa.next();canvas.drawText(text, textX, textY, calendarTextPaint);textX += (int) (textWidth + calendarFontSpacing);startX = stopX = textX;}textY += (int) (calendarFontSpacing);try {Date startData = new SimpleDateFormat("yyyy-MM-dd").parse(task.start);Date finishData = new SimpleDateFormat("yyyy-MM-dd").parse(task.finish);Log.e(TAG, "Start: " + String.valueOf(startData) + " Finish: " + finishData);Coordinate startCoordinates = coordinates.get(startData);Coordinate finishCoordinates = coordinates.get(finishData);Log.e(TAG, "Start: " + startCoordinates.toString() + "Finish: " + finishCoordinates);canvas.drawRect(startCoordinates.x + 5, startY + 5, finishCoordinates.x + calendarFontSpacing - 5, stopY - 5, paint);} catch (Exception e) {}
//            canvas.drawText(task.name, textX, textY, calendarTextPaint);startY += (int) (calendarFontSpacing);canvas.drawLine(canvasLeft, startY, calendarRight, stopY, calendarPaint);stopY += (int) (calendarFontSpacing);}}private Paint calendarPaint = new Paint();private TextPaint calendarTextPaint = new TextPaint();private int calendarFontSpacing;private int calendarLeft, calendarTop, calendarRight, calendarBottom;private void calendar(String startDate, String endDate) throws ParseException {calendarPaint.setStyle(Paint.Style.STROKE);calendarPaint.setColor(Color.DKGRAY);calendarPaint.setStrokeWidth(2);
//        calendarPaint.setTextSize(sp2px(20));
//        paint.setAlpha(50);calendarTextPaint.setTextSize(sp2px(20));calendarFontSpacing = (int) calendarTextPaint.getFontSpacing();//
//        Paint paint = new Paint();
//        paint.setTypeface(Typeface.DEFAULT);
//        paint.setTextSize(getTextSize());
//        Paint.FontMetrics fontMetrics = paint.getFontMetrics();
//        float textHeight = fm.getAscent() + fm.getDescent();//        float calendarFontSpacing = fontMetrics.descent - fontMetrics.ascent;
//        float calendarFontSpacing = fontMetrics.bottom - fontMetrics.top;//        Paint.FontMetrics fontMetrics = calendarPaint.getFontMetrics();
//        float textHeight = fontMetrics.getAscent() + fontMetrics.getDescent();// 边框canvas.drawRect(canvasLeft, canvasTop + titleHeight, canvasRight, canvasBottom, calendarPaint);table();calendarLeft = canvasLeft + tableEnd;calendarTop = canvasTop + titleHeight;calendarRight = canvasRight;calendarBottom = canvasBottom;int textX = calendarLeft;int textY = calendarTop + (int) calendarFontSpacing * 2;int startX = calendarLeft;int startY = calendarTop + (int) calendarFontSpacing * 1;int stopX = 0;int stopY = calendarBottom;canvas.drawLine(startX, calendarTop + calendarFontSpacing * 1, calendarRight, calendarTop + calendarFontSpacing * 1, calendarPaint);canvas.drawLine(startX, startY - calendarFontSpacing, startX, stopY, calendarTextPaint);canvas.drawLine(canvasLeft, calendarTop + calendarFontSpacing * 2, calendarRight, calendarTop + calendarFontSpacing * 2, calendarPaint);canvas.drawLine(canvasLeft, calendarTop + calendarFontSpacing * 3, canvasRight, calendarTop + calendarFontSpacing * 3, calendarPaint);//        Paint paint = new Paint();calendarPaint.setStyle(Paint.Style.FILL);calendarPaint.setColor(Color.BLUE);calendarPaint.setStrokeWidth(2);startY = calendarTop + (int) calendarFontSpacing * 2;int measureWeek = (int) calendarTextPaint.measureText("六");int measureDay = (int) calendarTextPaint.measureText("30");int measureText = measureWeek > measureDay ? measureWeek : measureDay;List<String> weeks = List.of("日", "一", "二", "三", "四", "五", "六");Calendar calendar = Calendar.getInstance();SimpleDateFormat format = new SimpleDateFormat("yyyy-MM");Date d1 = new SimpleDateFormat("yyyy-MM-dd").parse(startDate);//定义起始日期Date d2 = new SimpleDateFormat("yyyy-MM-dd").parse(endDate);//定义结束日期calendar.setTime(d2);calendar.add(Calendar.DATE, 1);d2 = calendar.getTime();calendar.setTime(d1);//设置日期起始时间while (calendar.getTime().before(d2)) {//判断是否到结束日期String month = new SimpleDateFormat("yyyy-MM").format(calendar.getTime());String day = new SimpleDateFormat("d").format(calendar.getTime());coordinates.put(calendar.getTime(), new Coordinate(startX, startY));
//            if (dateRange.containsKey(month)) {
//                List<Date> tmp = dateRange.get(month);
//                tmp.add(calendar.getTime());
//            } else {
//                dateRange.put(month, List.of(calendar.getTime()));
//            }int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK);String week = weeks.get(dayOfWeek - 1);if (Set.of("六", "日").contains(week)) {calendarPaint.setColor(Color.WHITE);} else {calendarPaint.setColor(Color.GRAY);}
//            Log.d(TAG, String.valueOf());
//            Log.d(TAG, String.valueOf());stopX = (int) (startX + measureText);canvas.drawRect(startX, startY, stopX, stopY, calendarPaint);canvas.drawText(week, textX, textY, calendarTextPaint);if (calendarTextPaint.measureText(day) < calendarTextPaint.measureText(week)) {canvas.drawText(day, textX + calendarTextPaint.measureText(day) / 2, textY + calendarFontSpacing, calendarTextPaint);} else {canvas.drawText(day, textX, textY + calendarFontSpacing, calendarTextPaint);}if (day.equals("1")) {canvas.drawText(month, textX, textY - calendarFontSpacing, calendarTextPaint);canvas.drawLine(startX, startY - calendarFontSpacing * 2, startX, stopY, calendarTextPaint);}if (week.equals("日")) {canvas.drawLine(stopX, startY - calendarFontSpacing, stopX, stopY, calendarTextPaint);}textX += measureText + 2;startX = textX;calendar.add(Calendar.DATE, 1);//进行当前日期月份加1}calendarPaint.setColor(Color.GRAY);canvas.drawLine(canvasLeft, calendarTop + calendarFontSpacing * 2, calendarRight, calendarTop + calendarFontSpacing * 2, calendarPaint);canvas.drawLine(canvasLeft, calendarTop + calendarFontSpacing * 3, canvasRight, calendarTop + calendarFontSpacing * 3, calendarPaint);calendarLeft = stopX;}public class Data {public Data(String name, String start, String finish, String day, String resource) {this.name = name;this.start = start;this.finish = finish;this.day = day;this.resource = resource;}public String name;public String start;public String finish;public String day;public String resource;}
//    public class Coordinate{
//
//    }public void setTextSize(int textSize) {this.textSize = textSize;}public int getTextSize() {return textSize;}/*** Gets the example dimension attribute value.** @return The example dimension attribute value.*/
//    public float getExampleDimension() {
//        return mExampleDimension;
//    }/*** Sets the view"s example dimension attribute value. In the example view, this dimension* is the font size.** @param exampleDimension The example dimension attribute value to use.*/
//    public void setExampleDimension(float exampleDimension) {
//        mExampleDimension = exampleDimension;
//        invalidateTextPaintAndMeasurements();
//    }/*** Gets the example drawable attribute value.** @return The example drawable attribute value.*/
//    public Drawable getExampleDrawable() {
//        return mExampleDrawable;
//    }/*** Sets the view"s example drawable attribute value. In the example view, this drawable is* drawn above the text.** @param exampleDrawable The example drawable attribute value to use.*/
//    public void setExampleDrawable(Drawable exampleDrawable) {
//        mExampleDrawable = exampleDrawable;
//    }private void week() {Paint paint = new Paint();paint.setStyle(Paint.Style.FILL);paint.setColor(Color.BLUE);paint.setStrokeWidth(2);//        Paint.FontMetrics fontMetrics = textPaint.getFontMetrics();
//        float fontSpacing = calendarTextPaint.getFontSpacing();int textX = calendarLeft;int textY = calendarTop + (int) calendarFontSpacing * 2;int startX = calendarLeft;int startY = calendarTop + (int) calendarFontSpacing * 2;int stopX = 0;int stopY = calendarBottom;int measureWeek = (int) calendarTextPaint.measureText("六");int measureDay = (int) calendarTextPaint.measureText("30");int measureText = measureWeek > measureDay ? measureWeek : measureDay;List<String> weeks = List.of("一", "二", "三", "四", "五", "六", "日");int w = 0;for (int i = 1; i <= 31; i++) {//            for (String week : List.of("一", "二", "三", "四", "五", "六", "日")) {String week = weeks.get(w);w++;if (w >= weeks.size()) {w = 0;}String day = String.valueOf(i);if (Set.of("六", "日").contains(week)) {paint.setColor(Color.WHITE);} else {paint.setColor(Color.GRAY);}
//            Log.d(TAG, String.valueOf());
//            Log.d(TAG, String.valueOf());stopX = (int) (startX + measureText);canvas.drawRect(startX, startY, stopX, stopY, paint);canvas.drawText(week, textX, textY, calendarTextPaint);if (calendarTextPaint.measureText(day) < calendarTextPaint.measureText(week)) {canvas.drawText(day, textX + calendarTextPaint.measureText(day) / 2, textY + calendarFontSpacing, calendarTextPaint);} else {canvas.drawText(day, textX, textY + calendarFontSpacing, calendarTextPaint);}
//                if (week.equals("一")) {
//                    canvas.drawLine(startX, startY - calendarFontSpacing, startX, stopY, calendarTextPaint);
//                }if (week.equals("日")) {canvas.drawLine(stopX, startY - calendarFontSpacing, stopX, stopY, calendarTextPaint);}textX += measureText + 2;startX = textX;
//            stopX = (int) (startX + fontSpacing);}calendarLeft = stopX;}
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/pingmian/45675.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Python番外篇:万法归一,一切皆对象

目录 Python中的对象 一切皆对象 数字是对象 字符串是对象 内置类型也是对象 函数和类也是对象 总结 Python中的对象 对象是Python对数据的抽象&#xff0c;在Python程序中&#xff0c;所有的数据&#xff0c;都可以由对象或对象之间的关系表示。 从某种意义上说&#…

基于AT89C51单片机GSM模块的家庭防火防盗报警系统设计(含文档、源码与proteus仿真,以及系统详细介绍)

本篇文章论述的是基于AT89C51单片机GSM模块的家庭防火防盗报警系统设计的详情介绍&#xff0c;如果对您有帮助的话&#xff0c;还请关注一下哦&#xff0c;如果有资源方面的需要可以联系我。 目录 摘 要 原理图 仿真图 元器件清单 代码 系统论文 参考文献 资源下载…

Memcached内存碎片清理术:优化缓存性能的策略

标题&#xff1a;Memcached内存碎片清理术&#xff1a;优化缓存性能的策略 内存碎片是Memcached在长期运行过程中常见的问题&#xff0c;它会降低缓存效率并影响性能。作为高效的分布式内存缓存系统&#xff0c;Memcached提供了多种内存碎片整理策略。本文将详细介绍这些策略&…

几何建模-Parasolid中GO功能使用

1.背景介绍 1.1 Parasolid和它的接口间关系 1.2 什么是GO GO全称是Graphical Output.你的程序需要在屏幕或者打印设备上显示模型数据时。在需要使用PK中的某个渲染函数时创建图形显示数据时&#xff0c;Parasolid会调用GO相关的函数。GO函数会输出绘图指令给你的应用程序提供…

《昇思25天学习打卡营第14天|SSD目标检测》

SSD&#xff08;Single Shot MultiBox Detector&#xff09;是一种用于目标检测的深度学习算法。它的设计旨在同时检测多个对象&#xff0c;并确定它们在图像中的位置和类别。与其他目标检测算法相比&#xff0c;SSD具有速度快和精度高的特点&#xff0c;在实时检测应用中非常受…

层次分析法:matlab代码实现

计算权重&#xff1a; 一、算术平均法 关于矩阵&#xff1a; 1、矩阵的输入写法 [ ; ; ]同行用空格或逗号隔开&#xff0c;不同行用分号间隔 2、矩阵求和 默认按列求和 asum(E) 等同于 asum(E,1) 得到行向量 按行求和 asum(E,2) 得到列向量 对整个矩阵求和 asum(E,"all&…

昇思25天学习打卡营第18天|MindNLP ChatGLM-6B StreamChat

现在各类chat AI不胜枚举&#xff0c;开源的闭源的都有&#xff0c;ChatGLM-6B是其中一个开源的chat AI模型&#xff0c;我们可以使用mindspore轻松的跑起来这个模型 官方提供的jupyter示例里面却少了安装mindnlp和mdtex2html&#xff0c;所以需要先把这两个模块安装一下。 !…

Python实战指南:一键解锁KimiGPT API,开启智能对话与文本生成的新纪元

Python实战指南&#xff1a;一键解锁KimiGPT API&#xff0c;开启智能对话与文本生成的新纪元 引言 随着人工智能技术的飞速发展&#xff0c;自然语言处理&#xff08;NLP&#xff09;成为了众多领域的核心技术之一。KimiGPT&#xff0c;作为国内广受欢迎的AI工具&#xff0c…

【/etc/profile、~/.bashrc、~/.bash_profile区别以及配置history记录】

目录 /etc/profile、~/.bashrc、~/.bash_profile区别/etc/profile~/.bash_profile~/.bashrc加载顺序和关系示例/etc/profile~/.bash_profile&#xff08;用户级别&#xff09;~/.bashrc&#xff08;用户级别&#xff09; history记录配置修改 /etc/profile确保用户的 ~/.bash_p…

TCP网络传输控制协议

目录 什么是TCP TCP的特点 TCP通信步骤 三次握手&#xff08;建立连接&#xff09; 数据传输 四次挥手&#xff08;连接释放&#xff09; 为什么要进行三次握手&#xff1f;两次握手行不行&#xff1f;一次握手行不行&#xff1f; 为什么是四次挥手&#xff1f;三次、两…

【Dison夏令营 Day 17】使用 Python Turtle 的 24 游戏求解器

24 点 是一个数学谜题&#xff0c;用基本算术运算符&#xff08;、-、、&#xff09;将 4 个数字运算成 24。例如&#xff0c;给定 4 个数字 1,5,5,5&#xff0c;我们可以得到表达式 (5-(15))5&#xff0c;等于 24。 我们可以用 Python 程序暴力解决这个问题。最多有 245444 7…

Vue的生命周期函数有哪些?详细说明

Vue.js 的生命周期函数包括以下几个阶段&#xff0c;每个阶段都有相应的钩子函数可以用来在特定时机执行自定义的逻辑。这些生命周期钩子函数使得我们可以在组件的不同阶段进行操作&#xff0c;从而管理组件的状态和行为。 1. beforeCreate&#xff1a; - 描述&#xff1a;…

【游戏客户端】大话slg玩法架构(三)建筑控件

【游戏客户端】大话slg玩法架构&#xff08;三&#xff09;建筑控件 大家好&#xff0c;我是Lampard家杰~~ 今天我们继续给大家分享SLG玩法的实现架构&#xff0c;关于SLG玩法的介绍可以参考这篇上一篇文章&#xff1a;【游戏客户端】制作率土之滨Like玩法 PS&#xff1a;和之前…

谈谈软件交互设计

谈谈软件交互设计 交互设计的由来 交互设计(Interaction Design)这一概念,最初是由IDEO创始人之一Bill.Moggridge(莫格里奇)1984年在一次会议上提出。他设计了世界上第一台笔记本电脑Compass,并写作出版了在交互设计领域影响深远的《Designing Interactions》一书,被称…

使用 Akshare 下载国内的期货(主力连续)、股票和指数的历史行情数据

本文介绍如何使用 akshare 下载国内期货、股票和指数的历史行情数据。 Akshare 是一个丰富的金融数据查询的 Python 库&#xff0c;提供了大量的金融数据接口。本文将详细介绍如何使用 Akshare 下载期货、股票和指数数据&#xff0c;并提供完整的代码示例&#xff0c;以求大家…

当需要在不同操作系统和编程语言环境中共享和处理 XML 数据时,可能会遇到哪些兼容性问题,以及如何解决?

在不同操作系统和编程语言环境中共享和处理 XML 数据时&#xff0c;可能会遇到以下兼容性问题&#xff1a; 编码问题&#xff1a;不同操作系统和编程语言对于 XML 文件的默认编码可能不同。如果使用不同的编码方式&#xff0c;可能会导致乱码或无法正确解析 XML 数据。解决方法…

Java算法题-找到数组所有左边数都比它小, 右边数都比它大的数

实例1&#xff1a; 输入:[1,2,4,3,7,8,9] 输出:[1,2,7,8,9] 条件一&#xff1a;左边的数都比他小 条件二&#xff1a;右边的数都不比他大 思路&#xff1a;遍历两次,一次从左往右&#xff0c;找到满足条件一的数&#xff0c;一次从后往前找到满足条件二的数&#xff0c;两次遍…

微服务架构实战:案例分析与解决方案探讨

摘要 微服务架构以其模块化和灵活性在软件开发领域迅速崛起。然而&#xff0c;这种架构模式并非没有挑战。本文通过深入分析几个实际的微服务项目案例&#xff0c;探讨了在设计、开发和部署过程中遇到的问题&#xff0c;以及相应的解决方案。同时&#xff0c;文章还展示了微服…

请不要把「团队」二字挂在嘴边上

请不要把「团队」二字挂在嘴边上 什么是团队? 团队(Team)是由 基层和 管理层人员组成的一个 共同体,它合理利用每一个 成员的知识和技能协同工作,解决问题,达到 共同的目标。 团队的构成要素总结为5P,分别为目标、人、 定位、权限、计划。 群体不是团队 “团队”和“…

智能合约和分布式应用管理系统:技术革新与未来展望

引言 随着区块链技术的不断发展&#xff0c;智能合约和分布式应用&#xff08;DApps&#xff09;逐渐成为数字经济中的重要组成部分。智能合约是一种自执行的协议&#xff0c;能够在预设条件满足时自动执行代码&#xff0c;而无需人工干预或中介机构。这种自动化和信任机制极大…