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;如果有资源方面的需要可以联系我。 目录 摘 要 原理图 仿真图 元器件清单 代码 系统论文 参考文献 资源下载…

几何建模-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;在实时检测应用中非常受…

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

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

【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…

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

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

谈谈软件交互设计

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

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

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

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

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

使用Apache服务部署静态网站

前言&#xff1a;本博客仅作记录学习使用&#xff0c;部分图片出自网络&#xff0c;如有侵犯您的权益&#xff0c;请联系删除 目录 一、网站服务程序 ​二、配置服务文件参数 ​三、SELinux安全子系统 四、个人用户主页功能 ​五、虚拟网站主机功能 六、Apache的访问控制…

nx上darknet的使用-目标检测-在python中的使用

1 内置的代码 在darknet中已经内置了两个py文件 darknet_video.py与darknet_images.py用法类似&#xff0c;都是改一改给的参数就行了&#xff0c;我们说一下几个关键的参数 input 要预测哪张图像weights 要使用哪个权重config_file 要使用哪个cfg文件data_file 要使用哪个da…

基于AT89C51单片机篮球计时计分器的设计(含文档、源码与proteus仿真,以及系统详细介绍)

本篇文章论述的是基于AT89C51单片机篮球计时计分器的设计的详情介绍&#xff0c;如果对您有帮助的话&#xff0c;还请关注一下哦&#xff0c;如果有资源方面的需要可以联系我。 目录 绪论 原理图 ​编辑 仿真图 系统总体设计图 代码实现 系统论文 资源下载 绪论 本次…

通用详情页的打造

背景介绍 大家都知道&#xff0c;详情页承载了站内的核心流量。它的量级到底有多大呢&#xff1f; 我们来看一下&#xff0c;日均播放次数数亿次&#xff0c;这么大的流量&#xff0c;其重要程度可想而知。 在这样一个页面&#xff0c;每一个功能都是大量业务的汇总点。 作为…

【Web开发手礼】探索Web开发的魅力(三)-html基础标签(3)

上述主要是对html标签的介绍和一些基本练习可以当作日常笔记收藏一下&#xff01;&#xff01;&#xff01; 目录 前言 html基础标签 前言 上述主要是对html标签的介绍和一些基本练习可以当作日常笔记收藏一下&#xff01;&#xff01;&#xff01; 提示&#xff1a;以下是本…

PostgreSQL 怎样处理数据仓库中维度表和事实表的关联性能?

文章目录 PostgreSQL 中维度表和事实表关联性能的处理 PostgreSQL 中维度表和事实表关联性能的处理 在数据仓库的领域中&#xff0c;PostgreSQL 作为一款强大的关系型数据库管理系统&#xff0c;对于处理维度表和事实表的关联性能是一个关键的问题。维度表和事实表的关联是数据…

【手写数据库内核组件】0301 动态内存池,频繁malloc/free让系统不堪重负,动态内存池让应用自由使用动态内存

动态内存管理 ​专栏内容&#xff1a; postgresql使用入门基础手写数据库toadb并发编程 个人主页&#xff1a;我的主页 管理社区&#xff1a;开源数据库 座右铭&#xff1a;天行健&#xff0c;君子以自强不息&#xff1b;地势坤&#xff0c;君子以厚德载物. 文章目录 动态内存管…

RSA算法详解:万字文章详解RSA的加密与解密

本文目录 文章前言一、RSA的诞生1、加密算法的前世今生① 《六韬龙韬》中的阴符与阴书② 古罗马&#xff1a;凯撒密码③ 斯巴达&#xff1a;塞塔式密码&#xff08;Scytale&#xff09; 2、对称加密的脆弱性3、非对称加密算法的出现 二、RSA中的数学概念与定理1、质数理论2、关…

使用Qt和mitmproxy开发一个抓取网页短视频的万能工具

目录 实现原理 mitmproxy介绍 功能简介 安装 脚本示例 如何使用 解释 注意事项 QT工具实现 其他资源 实现原理 使用WebView组件造一工具,工具可输入网页地址并显示网页内容及播放视频。把工具的代理设置指向mitmproxy的端口服务。配合使用mitmproxy的MITM技术,监…

7.8~7.10练习

目录 1.扑克牌游戏 2.链表基本功能的实现&#xff08;单项链表&#xff09; 3.移除链表元素力扣 4.反转链表力扣 5.链表的中间结点 5.返回倒数第k个节点​编辑 6.合并两个有序链表 7.链表基本功能的实现&#xff08;双向链表&#xff09; 8.链表分割 1.扑克牌游戏 public…